Created
February 28, 2018 23:31
-
-
Save jasonnerothin/dc59432476cb481e200022b65c3af014 to your computer and use it in GitHub Desktop.
resistor_algo.cpp
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
// ...And we will take two more readings. | |
int on_1 = analogRead(photoresistor); // read photoresistor | |
delay(200); // wait 200 milliseconds | |
int on_2 = analogRead(photoresistor); // read photoresistor | |
delay(300); // wait 300 milliseconds | |
intactValue = (on_1+on_2)/2; | |
brokenValue = (off_1+off_2)/2; | |
beamThreshold = (intactValue+brokenValue)/2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment