aboutsummaryrefslogtreecommitdiff
path: root/libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@at.or.at>2008-09-16 17:18:41 +0000
committerHans-Christoph Steiner <hans@at.or.at>2008-09-16 17:18:41 +0000
commit03a51e5ab74fab32ca6809074bdee7f27b5acf2a (patch)
tree392f3125f0374f2da25f2ed74e2cfad2aa82e0ea /libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde
parente94fa49d9bfee00e61a3b496b5e9cbb22dec309f (diff)
removed deprecated timer0_overflow_count, which wasn't meant to be public
anyway. Replaced it with the official millis() method of getting the time.
Diffstat (limited to 'libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde')
-rw-r--r--libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde10
1 files changed, 5 insertions, 5 deletions
diff --git a/libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde b/libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde
index 8d78f30..fcd8e5e 100644
--- a/libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde
+++ b/libraries/Firmata/examples/AnalogFirmata/AnalogFirmata.pde
@@ -16,8 +16,8 @@ Servo servo9, servo10; // one instance per pin
int analogInputsToReport = 0; // bitwise array to store pin reporting
int analogPin = 0; // counter for reading analog pins
/* 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
/*==============================================================================
@@ -71,9 +71,9 @@ void loop()
{
while(Firmata.available())
Firmata.processInput();
-
- 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
for(analogPin=0;analogPin<TOTAL_ANALOG_PINS;analogPin++) {
if( analogInputsToReport & (1 << analogPin) )
Firmata.sendAnalog(analogPin, analogRead(analogPin));