Changeset 4aaeb66 for de.wigbels.avr/sketchbook/hothotheat
- Timestamp:
- 05/17/2009 10:25:10 PM (16 years ago)
- Branches:
- master
- Children:
- 71bba07
- Parents:
- 78394ea
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
de.wigbels.avr/sketchbook/hothotheat/hothotheat.pde
r78394ea r4aaeb66 24 24 #include <pins_butterfly.h> 25 25 26 int inputPin = PBPIN4; 26 int inputReed = PBPIN4; 27 int outputLED = PBPIN6; 28 27 29 int value = 0; 30 int debounce = 0; 28 31 29 32 30 33 void setup() { 31 34 Serial.begin(9600); 32 pinMode(inputPin, INPUT); 35 pinMode(inputReed, INPUT); 36 pinMode(outputLED, OUTPUT); 33 37 } 34 38 35 voidgetSamples(){39 int getSamples(){ 36 40 Serial.print("1"); 37 41 Serial.print("\t"); … … 39 43 Serial.println(); 40 44 41 value = digitalRead(inputPin); 42 if (value == HIGH) { 43 Serial.println("HIGH"); 45 // switchtime of reed is 18 ms including debouncing... 46 value = digitalRead(inputReed); 47 delay(20); 48 debounce = digitalRead(inputReed); 49 if (value==debounce) { 50 if (value == HIGH) { 51 Serial.println("HIGH"); 52 return 1; 53 } 54 else { 55 Serial.println("LOW"); 56 return 0; 57 } 44 58 } 45 else {46 Serial.println("LOW");47 }48 59 } 49 60 50 61 void loop() { 51 62 TempSense.overSample = true; 52 getSamples(); 53 delay(400); 63 if(getSamples()==1) { 64 digitalWrite(outputLED, HIGH); 65 } else { 66 digitalWrite(outputLED, LOW); 67 } 68 69 delay(100); 54 70 }
Note:
See TracChangeset
for help on using the changeset viewer.