aboutsummaryrefslogtreecommitdiff
path: root/libraries/Firmata/examples
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@at.or.at>2008-09-12 16:53:57 +0000
committerHans-Christoph Steiner <hans@at.or.at>2008-09-12 16:53:57 +0000
commitbf4484d02c6e744488561a79f28807dc32dba705 (patch)
treee45ade521f225877ec60e43e70a7d836879d4cf3 /libraries/Firmata/examples
parentad860f84d3e561767d434c88ee8e25e6ea612e18 (diff)
switched up analogRead() loop to use the revamped millis() function rather than the private timer0_overflow_count variable
Diffstat (limited to 'libraries/Firmata/examples')
-rw-r--r--libraries/Firmata/examples/StandardFirmata/StandardFirmata.pde9
1 files changed, 5 insertions, 4 deletions
diff --git a/libraries/Firmata/examples/StandardFirmata/StandardFirmata.pde b/libraries/Firmata/examples/StandardFirmata/StandardFirmata.pde
index 40afcae..4cc8539 100644
--- a/libraries/Firmata/examples/StandardFirmata/StandardFirmata.pde
+++ b/libraries/Firmata/examples/StandardFirmata/StandardFirmata.pde
@@ -32,8 +32,8 @@ byte pinStatus[TOTAL_DIGITAL_PINS]; // store pin status, default OUTPUT
byte portStatus[TOTAL_PORTS];
/* timer variables */
-extern volatile unsigned long timer0_overflow_count; // timer0 from wiring.c
-unsigned long nextExecuteTime; // for comparison with timer0_overflow_count
+unsigned long currentMillis; // store the current value from millis()
+unsigned long nextExecuteMillis; // for comparison with currentMillis
/*==============================================================================
@@ -204,8 +204,9 @@ void loop()
/* DIGITALREAD - as fast as possible, check for changes and output them to the
* FTDI buffer using Serial.print() */
checkDigitalInputs();
- if(timer0_overflow_count > nextExecuteTime) {
- nextExecuteTime = timer0_overflow_count + 19; // run this every 20ms
+ currentMillis = millis();
+ if(currentMillis > nextExecuteMillis) {
+ nextExecuteMillis = currentMillis + 19; // run this every 20ms
/* SERIALREAD - Serial.read() uses a 128 byte circular buffer, so handle
* all serialReads at once, i.e. empty the buffer */
while(Firmata.available())