Created
October 16, 2012 08:58
-
-
Save biskandar/3898158 to your computer and use it in GitHub Desktop.
Reading Arduino's Analog Pins with JSON Protocol by using WiFi Shield 2012101602
This file contains hidden or 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
void loop() { | |
// validate every one second | |
long newMillis = millis() ; | |
if ( ( newMillis - curMillis ) > 1000 ) { | |
ctrSeconds = ctrSeconds + 1 ; | |
if ( ( ctrSeconds % secAnalogs ) == 0 ) { | |
readAnalogs() ; // <- read all analog pins | |
} | |
if ( ( ctrSeconds % secDebug ) == 0 ) { | |
infoAnalogs() ; // <- debug purpose | |
} | |
if ( ctrSeconds > maxSeconds ) { | |
ctrSeconds = 0 ; | |
} | |
curMillis = newMillis ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment