Show
Ignore:
Timestamp:
05/18/09 21:57:46 (3 years ago)
Author:
njw
Message:

added some lcd-printouts for initial testing...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • de.wigbels.avr/sketchbook/hothotheat/hothotheat.pde

    r22 r23  
    2424#include <pins_butterfly.h> 
    2525 
     26#include <LCD_Driver.h> 
     27#include <timer2_RTC.h> 
     28 
     29 
    2630int inputReed = PBPIN4; 
    27 int outputLED = PBPIN6; 
     31int outputLED = PBPIN3; 
    2832 
    2933int value = 0; 
    3034int debounce = 0; 
    3135 
     36long gasReeds = 0; 
    3237 
    3338void setup() { 
     39  LCD.prints_f(PSTR("HOTHOTHEAT")); 
     40  delay(2500); 
     41  
     42  // Set up the RTC timer to call the secTick() function every second. 
     43  RTCTimer.init( secTick ); 
     44   
    3445  Serial.begin(9600);  
     46 
     47  TempSense.overSample = true; 
     48 
    3549  pinMode(inputReed, INPUT); 
    3650  pinMode(outputLED, OUTPUT); 
    3751} 
    3852 
    39 int getSamples(){ 
     53void secTick() 
     54{ 
     55  LCD.print( gasReeds ); 
     56  LCD.println( " tGR" ); 
     57} 
     58 
     59int getSamples() { 
     60  // Temperature = Sensor 1 
    4061  Serial.print("1"); 
    4162  Serial.print("\t"); 
    42   Serial.print(TempSense.getTemp(CELSIUS)); 
    43   Serial.println();   
     63  Serial.println(TempSense.getTemp(CELSIUS)); 
    4464 
    4565  // switchtime of reed is 18 ms including debouncing... 
     
    4767  delay(20); 
    4868  debounce = digitalRead(inputReed); 
     69 
     70  // Reedcontact = Sensor 2 
    4971  if (value==debounce) { 
     72    Serial.print("2"); 
     73    Serial.print("\t"); 
    5074    if (value == HIGH) { 
    5175      Serial.println("HIGH"); 
     76      gasReeds++; 
    5277      return 1; 
    5378    } 
     
    6085 
    6186void loop() {   
    62   TempSense.overSample = true; 
     87  // Switch LED on for a certain time to mark a switched Reed contact 
    6388  if(getSamples()==1) { 
    6489    digitalWrite(outputLED, HIGH);