Changeset 71bba07 for de.wigbels.avr/sketchbook
- Timestamp:
- 05/18/2009 09:57:46 PM (16 years ago)
- Branches:
- master
- Children:
- a5924d3
- Parents:
- 4aaeb66
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
de.wigbels.avr/sketchbook/hothotheat/hothotheat.pde
r4aaeb66 r71bba07 24 24 #include <pins_butterfly.h> 25 25 26 #include <LCD_Driver.h> 27 #include <timer2_RTC.h> 28 29 26 30 int inputReed = PBPIN4; 27 int outputLED = PBPIN 6;31 int outputLED = PBPIN3; 28 32 29 33 int value = 0; 30 34 int debounce = 0; 31 35 36 long gasReeds = 0; 32 37 33 38 void 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 34 45 Serial.begin(9600); 46 47 TempSense.overSample = true; 48 35 49 pinMode(inputReed, INPUT); 36 50 pinMode(outputLED, OUTPUT); 37 51 } 38 52 39 int getSamples(){ 53 void secTick() 54 { 55 LCD.print( gasReeds ); 56 LCD.println( " tGR" ); 57 } 58 59 int getSamples() { 60 // Temperature = Sensor 1 40 61 Serial.print("1"); 41 62 Serial.print("\t"); 42 Serial.print(TempSense.getTemp(CELSIUS)); 43 Serial.println(); 63 Serial.println(TempSense.getTemp(CELSIUS)); 44 64 45 65 // switchtime of reed is 18 ms including debouncing... … … 47 67 delay(20); 48 68 debounce = digitalRead(inputReed); 69 70 // Reedcontact = Sensor 2 49 71 if (value==debounce) { 72 Serial.print("2"); 73 Serial.print("\t"); 50 74 if (value == HIGH) { 51 75 Serial.println("HIGH"); 76 gasReeds++; 52 77 return 1; 53 78 } … … 60 85 61 86 void loop() { 62 TempSense.overSample = true;87 // Switch LED on for a certain time to mark a switched Reed contact 63 88 if(getSamples()==1) { 64 89 digitalWrite(outputLED, HIGH);
Note:
See TracChangeset
for help on using the changeset viewer.