Skip to content

Report initial input pin value #134

@nandlab

Description

@nandlab

Thanks for your incredible work developing the firmata protocol!
I have forked the C++ firmata client implementation from dimitry-ishenko-cpp to adjust a few things: https://github.com/NANDLAB/firmata.
Here's the issue I had with his library: dimitry-ishenko-cpp/firmata#14

I have a set of pins, which I configure as PULLUP. I would like to know their initial value after setting the PULLUP input mode. How can I do this with firmata in general?

That's how I would set the pin (let's say pin 1) to pullup:

0  set digital pin mode (0xF4) (MIDI Undefined)
1  pin number 1
2  mode PULLUP (11)

Here's what I found in the documentation about setting digital reporting:

Toggle digital port reporting by port (second nibble of byte 0), eg 0xD1 is port 1 is pins 8 to 15

0  toggle digital port reporting (0xD0-0xDF) (MIDI Aftertouch)
1  disable(0) / enable(non-zero)

As of Firmata 2.4.0, upon enabling a digital port, the port value should be reported to the client
application.

If I understand it correctly, if I set pin 1 to pullup and then enable digital reporting for port 0, the firmata server would respond with the value of port 0, where I could extract the value of pin 1.

But what happens if digital reporting is already enabled for port 0, and I additionally set pin 2 to pullup? Will the value of port 0 be reported again, so that I can get the value of pin 2? Is this defined in the protocol?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions