Skip to content

Commit 2e09889

Browse files
committed
setSamplingInterval
1 parent 7165b6a commit 2e09889

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

FirmataMarshaller.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ const
266266
void FirmataMarshaller::sendPinStateQuery(uint8_t pin)
267267
const
268268
{
269-
sendSysex(PIN_STATE_QUERY, 1, &pin);
269+
sendSysex(PIN_STATE_QUERY, sizeof(pin), &pin);
270270
}
271271

272272
/**
@@ -298,3 +298,14 @@ const
298298
{
299299
sendSysex(STRING_DATA, strlen(string), (uint8_t *)string);
300300
}
301+
302+
/**
303+
* The sampling interval sets how often analog data and i2c data is reported to the client.
304+
* @param interval_ms The interval (in milliseconds) at which to sample
305+
* @note The default sampling interval is 19ms
306+
*/
307+
void FirmataMarshaller::setSamplingInterval(uint16_t interval_ms)
308+
const
309+
{
310+
sendSysex(SAMPLING_INTERVAL, sizeof(interval_ms), &interval_ms);
311+
}

FirmataMarshaller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class FirmataMarshaller
5252
void sendPinStateQuery(uint8_t pin) const;
5353
void sendString(const char *string) const;
5454
void sendSysex(uint8_t command, size_t bytec, uint8_t *bytev) const;
55+
void setSamplingInterval(uint16_t interval_ms) const;
5556

5657
private:
5758
/* utility methods */

0 commit comments

Comments
 (0)