Last active
August 29, 2015 14:05
-
-
Save mumblepins/1796cb14e7e629844074 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
double avgDelay; | |
double totalDelay; | |
unsigned long timer1; | |
unsigned long timer2; | |
int count=0; | |
void setup() { | |
Spark.variable("AvgDelay",&avgDelay,DOUBLE); | |
Serial.begin(115200); | |
while (!Serial.available()) SPARK_WLAN_Loop(); | |
} | |
void loop() { | |
timer2=micros(); | |
count++; | |
totalDelay+=timer2-timer1; | |
avgDelay=totalDelay/(double)count; | |
Serial.print(timer2-timer1); | |
Serial.print(" "); | |
Serial.println(avgDelay); | |
delay(1000); | |
Serial.println(micros()-timer2); | |
timer1=micros(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment