You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This observation is based solely on looking over the code. There is a potential issue in that digital pin reporting is actually managed per 'port' in Firmware, but in firmata.js it's managed at the pin level. If we trace the code execution path, a potential issue emerges:
User calls digitalRead on pin D2. User also calls digitalRead on pin D3 and pin D4.
Each time digitalRead is called (3 times total in this example), reportDigitalPin is called.
I'm trying to track down a problem with digitalRead and I'm encountering behavior that looks similar to this. I'm calling digitalRead on pins 1-8 asynchronously like...
pin = 1..8
set pinMode pin
setup digitalRead pin
(in callback)
reportDigitalPin(pin, 0)
externally trigger pin HIGH
There's a debug message inside the callback that starts reading out line...
This observation is based solely on looking over the code. There is a potential issue in that digital pin reporting is actually managed per 'port' in Firmware, but in firmata.js it's managed at the pin level. If we trace the code execution path, a potential issue emerges:
digitalRead
on pin D2. User also callsdigitalRead
on pin D3 and pin D4.digitalRead
is called (3 times total in this example),reportDigitalPin
is called.REPORT_DIGITAL
message is received, the pin values for all pins in the corresponding digital 'port' are reported, regardless of the last value of any of those pins. This will happen 3 times for all of these pin since they are all on the same port.One way to prevent this is to prevent
reportDigitalPin
in firmata.js from being enabled more than once for the same port.The text was updated successfully, but these errors were encountered: