Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
setSamplingInterval
  • Loading branch information
zfields committed Feb 26, 2017
commit 2e09889b2197ea2f260dc71ebddbef8ee238a6fe
13 changes: 12 additions & 1 deletion FirmataMarshaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ const
void FirmataMarshaller::sendPinStateQuery(uint8_t pin)
const
{
sendSysex(PIN_STATE_QUERY, 1, &pin);
sendSysex(PIN_STATE_QUERY, sizeof(pin), &pin);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sendSysex will send pin as 2 bytes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch! fixed.

}

/**
Expand Down Expand Up @@ -298,3 +298,14 @@ const
{
sendSysex(STRING_DATA, strlen(string), (uint8_t *)string);
}

/**
* The sampling interval sets how often analog data and i2c data is reported to the client.
* @param interval_ms The interval (in milliseconds) at which to sample
* @note The default sampling interval is 19ms
*/
void FirmataMarshaller::setSamplingInterval(uint16_t interval_ms)
const
{
sendSysex(SAMPLING_INTERVAL, sizeof(interval_ms), &interval_ms);
}
1 change: 1 addition & 0 deletions FirmataMarshaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class FirmataMarshaller
void sendPinStateQuery(uint8_t pin) const;
void sendString(const char *string) const;
void sendSysex(uint8_t command, size_t bytec, uint8_t *bytev) const;
void setSamplingInterval(uint16_t interval_ms) const;

private:
/* utility methods */
Expand Down