Arduino library to send key/value pairs from PC (Python) to Arduino
Python C++ C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.



Arduino library to provide simple sending of key/value pairs from a computer to the Arduino. (For example: I have a CPU usage value on my desktop computer, and want to use an Arduino to control some lights in response to that. This gets the number to from desktop to Arduino.)

To match DataReceiver (the Arduino side) is data_sender in Python. It depends on pySerial for serial communication.


See examples/ for a quick introduction. Even more briefly:


sender = data_sender.Sender('/dev/usb.serialmodemfa141')
with sender:
	while True:
		... # Generate a value.

		# Maybe handle responses from the Arduino.


#include <DataReceiver.h>
DataReceiver<1> receiver; // templated on # keys expected
void callback(size_t size, const char* value) {
	... // do something with value
void setup() {
	receiver.setup(); // Serial.begin
	receiver.addKey("KEY", &callback);
	receiver.sendReady(); // once ready to take Serial input
void loop() {
	receiver.readAndUpdate(); // read Serial, call callbacks