{"action":"created","issue":{"url":"https://api.github.com/repos/firmata/arduino/issues/293","repository_url":"https://api.github.com/repos/firmata/arduino","labels_url":"https://api.github.com/repos/firmata/arduino/issues/293/labels{/name}","comments_url":"https://api.github.com/repos/firmata/arduino/issues/293/comments","events_url":"https://api.github.com/repos/firmata/arduino/issues/293/events","html_url":"https://github.com/firmata/arduino/issues/293","id":158511016,"number":293,"title":"ability to read non changing digital input","user":{"login":"soundanalogous","id":401539,"avatar_url":"https://avatars.githubusercontent.com/u/401539?v=3","gravatar_id":"","url":"https://api.github.com/users/soundanalogous","html_url":"https://github.com/soundanalogous","followers_url":"https://api.github.com/users/soundanalogous/followers","following_url":"https://api.github.com/users/soundanalogous/following{/other_user}","gists_url":"https://api.github.com/users/soundanalogous/gists{/gist_id}","starred_url":"https://api.github.com/users/soundanalogous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundanalogous/subscriptions","organizations_url":"https://api.github.com/users/soundanalogous/orgs","repos_url":"https://api.github.com/users/soundanalogous/repos","events_url":"https://api.github.com/users/soundanalogous/events{/privacy}","received_events_url":"https://api.github.com/users/soundanalogous/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-04T16:04:36Z","updated_at":"2016-06-04T16:10:57Z","closed_at":null,"body":"Because Firmata only reports digital input values on change (via `DIGITAL_MESSAGE`), it is currently difficult to read a non-changing digital input. Currently there is only one way a non-changing digital pin value is reported and that is when a user enables reporting for a given port, the values of the pins on that port are reported even if they have not changed. However, depending on how a firmata host library and the user's code is structured, they may miss this value (for example a listener is declared after enabling port reporting). It is also not the most intuitive way to request a non-changing digital input.\r\n\r\nThere is [a proposal](https://github.com/firmata/protocol/issues/59) open for a way to report digital pin values. That would enable a user to request a specific digital pin value at any time.\r\n\r\nThe tricky part would be in the Firmata host library implementations. Currently a lot of host libraries use the wiring syntax of `digitalRead` to report the existing `DIGITAL_MESSAGE`. This only reports digital input changes where as the `PIN_VALUE_QUERY` would enable a closer equivalent to the wiring `digitalRead` function (aside from the async vs sync issue). One way to update host apis is to use `digitalReadOnce` to issue a `PIN_VALUE_QUERY`. Generally however host libraries would benefit by using `DIGITAL_MESSAGE` since it is more efficient (reporting on port basis and only on change) when `PIN_VALUE_QUERY` would then be used only for fixed (non-changing) digital inputs as well as the general case of reporting board state after a reconnection event (which was the original intent for the pin value query proposal)."},"comment":{"url":"https://api.github.com/repos/firmata/arduino/issues/comments/223763796","html_url":"https://github.com/firmata/arduino/issues/293#issuecomment-223763796","issue_url":"https://api.github.com/repos/firmata/arduino/issues/293","id":223763796,"user":{"login":"soundanalogous","id":401539,"avatar_url":"https://avatars.githubusercontent.com/u/401539?v=3","gravatar_id":"","url":"https://api.github.com/users/soundanalogous","html_url":"https://github.com/soundanalogous","followers_url":"https://api.github.com/users/soundanalogous/followers","following_url":"https://api.github.com/users/soundanalogous/following{/other_user}","gists_url":"https://api.github.com/users/soundanalogous/gists{/gist_id}","starred_url":"https://api.github.com/users/soundanalogous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundanalogous/subscriptions","organizations_url":"https://api.github.com/users/soundanalogous/orgs","repos_url":"https://api.github.com/users/soundanalogous/repos","events_url":"https://api.github.com/users/soundanalogous/events{/privacy}","received_events_url":"https://api.github.com/users/soundanalogous/received_events","type":"User","site_admin":false},"created_at":"2016-06-04T16:10:57Z","updated_at":"2016-06-04T16:10:57Z","body":"@rwaldron this is something we will need to think about regarding firmata.js. The issue is if a user has some hard wired digital inputs (such as a collection of switches or fixed inputs used to identify some value on startup for example), it is currently easy to miss these values since Firmata only reports digital input changes."}}
{"actor":{"display_login":"soundanalogous"}}