Last active
December 13, 2015 10:38
-
-
Save iH8c0ff33/e2ba263565b809d6dabc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint8_t prPin = 0;// Pin Fotoresistenza | |
uint8_t prTrigger = 50;// Se minore di questo trigger | |
// Programma | |
bool start = true; | |
unsigned long startTime = 0; | |
uint8_t count = 0; | |
void setup() { | |
pinMode(13, OUTPUT); | |
Serial.begin(9600); | |
delay(500); | |
digitalWrite(13, HIGH); | |
delay(250); | |
digitalWrite(13, LOW); | |
} | |
void loop() { | |
if (start) { | |
startTime = millis(); | |
start = false; | |
} else { | |
if (analogRead(prPin) > prTrigger) { | |
Serial.print(++count); | |
Serial.print(": "); | |
Serial.print((millis()-startTime)/1000.0); | |
Serial.println(); | |
start = true; | |
delay(200); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment