#arduino #protocols #json #plot #api-bindings

arduino-plotter

API bindings (protocol) and Server/Client API for Arduino serial plotter

1 unstable release

0.1.0 May 13, 2024

#65 in Visualization

Download history 127/week @ 2024-05-13 13/week @ 2024-05-20

140 downloads per month

MIT/Apache

28KB
250 lines

arduino-plotter

API bindings (protocol) with Client/Server crate for interacting with Arduino Serial Plotter

Arduino Serial Plotter: https://github.com/arduino/arduino-serial-plotter-webapp

sponsor-uscrates-iodocs-rsbuild-yml

Running arduino-serial-plotter webapp

Arduino Serial Plotter uses WebSockets to communicate by sending or receiving commands.

Requirements:

  • Node v10
git clone https://github.com/arduino/arduino-serial-plotter-webapp
# or when using ssh:
# `git clone git@github.com:arduino/arduino-serial-plotter-webapp.git`
cd arduino-serial-plotter-webapp
npm i && npm start

Default port: 3000

Connecting

The Arduino Serial Plotter will send a request to our CLI and the CLI is waiting for a connection on the websocket, this is why you need to open the arduino plotter app after starting the CLI:

http://localhost:3000 (with default port 3000)

Running example

By default, the examples will run at trace log level for the tracing subscriber, however, you can use the RUST_LOG env. variable to override it.

A minimal example

Running the minimal example will give you the most basic use of the crate but it will not be able to send data or handle change of End of Line messages from the Arduino Serial Plotter application.

cargo run --example minimal

A random data generator example

You can use run example for a basic usage of the Client and Server:

cargo run --example run

Refer to the documentation in the file for more details. The example does all the basic main functionality that you need and sends random data to the arduino-serial-plotter-webapp:

  • Sends initial settings
  • Sends Random data with 2 different data lines
  • Receives settings from the Arduino Serial Plotter and confirms a new End of Line by sending a settings message back to it
  • Receives data messages sent from the Arduino Serial Plotter UI and logs them using tracing to the console

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~8–18MB
~236K SLoC