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
Although not strictly limited by the Firmata protocol, currently Firmata implementations allow writing values to analog pins > 15 or analog (pwm) values > 14 bits using the EXTEND_ANALOG message. Reading analog input pins > 15 and/or analog input values > 14 bits should also be enabled.
There are a couple of options:
Use EXTENDED_ANALOG to report both analog input and analog output values:
0 START_SYSEX (0xF0)
1 extended analog message (0x6F)
2 pin (0-127)
3 bits 0-6 (least significant byte)
4 bits 7-13 (most significant byte)
... additional bytes may be sent if more bits are needed
N END_SYSEX (0xF7)
Create a separate message for reporting analog input values and repurpose EXTENDED_ANALOG to only report analog output (pwm) values (as it has traditionally been used):
0 START_SYSEX (0xF0)
1 extended analog write (0x6F)
2 pin (0-127)
3 bits 0-6 (least significant byte)
4 bits 7-13 (most significant byte)
... additional bytes may be sent if more bits are needed
N END_SYSEX (0xF7)
0 START_SYSEX (0xF0)
1 extended analog read (0x66)
2 pin (0-127)
3 bits 0-6 (least significant byte)
4 bits 7-13 (most significant byte)
... additional bytes may be sent if more bits are needed
N END_SYSEX (0xF7)
In either case, this would be accompanied by the ability to enable analog input reporting on pins > 15: #68 (comment)
The text was updated successfully, but these errors were encountered:
TBD if analog pin count should start from 0 or should start from actual pin number (for example analog 0 is actually pin number 14 on most Arduino boards).
Just to reiterate, it feels like you are doing a lot of extra work to use a nibble to adhere to the ANALOG_MESSAGE format. It is more bitwise efficient (so it deserves to remain), but it is hard-capped at 0xF and requires mapping to work correctly (as you mentioned Arduino natively supports the actual pin number).
If you look further down the Boards.h file, you can see how it doesn't scale well and starts to break down when the analog pins are in non-contiguous blocks. As boards become more diverse, it seems like EXTENDED_ANALOG is in a better position to adapt going forward.
Finally, this mapping is only available to clients through the protocol. The mapping requires a priming query, memory allocation and run-time mapping (which can be error prone and is far from efficient - code size or memory footprint).
Yeah for Firmata 3.0 it probably makes the most sense to simply deprecate ANALOG_MESSAGE and fully switch to EXTENDED_ANALOG. TBD whether or not to use the EXTENDED_ANALOG message for both reading and writing (PWM and possibly also shared with DAC).
Although not strictly limited by the Firmata protocol, currently Firmata implementations allow writing values to analog pins > 15 or analog (pwm) values > 14 bits using the EXTEND_ANALOG message. Reading analog input pins > 15 and/or analog input values > 14 bits should also be enabled.
There are a couple of options:
In either case, this would be accompanied by the ability to enable analog input reporting on pins > 15: #68 (comment)
The text was updated successfully, but these errors were encountered: