Created
May 10, 2017 18:49
-
-
Save nburn42/12f0f64303547abd7e834b57d29d4369 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
float pulsewidth = 10; // 1/100 a second | |
long count = 0; | |
long goal = 1024; | |
void setup() { | |
pinMode(13, OUTPUT); | |
} | |
void loop() { | |
delay(pulsewidth); | |
count = 0; | |
do { | |
if(analogRead(A2) > 500) { | |
goal = analogRead(A0); | |
} | |
delay(pulsewidth); | |
count += 15; | |
} while(count < goal); | |
digitalWrite(13, HIGH); | |
delay(pulsewidth); | |
digitalWrite(13, LOW); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment