Skip to content

Instantly share code, notes, and snippets.

@biskandar
Created October 16, 2012 08:58
Show Gist options
  • Save biskandar/3898158 to your computer and use it in GitHub Desktop.
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
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