firmata / firmata.js

JavaScript implementation of the Firmata protocol
711 stars 147 forks source link

Promise of completion #137

Open troywweber7 opened 8 years ago

troywweber7 commented 8 years ago

I have poured over the firmata.js file extensively. For some of the functions available on a board there is a callback that ensures the data has been sent because a response comes in. For other functions, you just send it and hope it happens. What is the preferred way to ensure a function like board.setSamplingInterval has actually completed? There is no callback function or response from the Arduino Board associated with this function.

My thought for how to resolve this: maybe I should call a dummy queryPinState function right after and use its callback? Or maybe using board.transport.drain will ensure that whatever I just queued up will be sent before I proceed?

soundanalogous commented 8 years ago

There is no way to do this because StandardFirmata running on the Arduino does not implement an RPC protocol. Many commands are only one direction.

soundanalogous commented 8 years ago

Also there is a proposal to add the ability to query the sampling interval: https://github.com/firmata/protocol/pull/34.