Arduino simpleRPC API client library and CLI¶
This library provides a simple way to interface to Arduino functions exported with the simpleRPC protocol. The exported method definitions are communicated to the host, which is then able to generate an API interface using this library.
- User friendly API library.
- Command line interface (CLI) for method discovery and testing.
- Function and parameter names are defined on the Arduino.
- API documentation is defined on the Arduino.
- Support for disconnecting and reconnecting.
- Support for serial and ethernet devices.
Please see ReadTheDocs for the latest documentation.
Export any function e.g.,
digitalWrite() on the
Arduino, these functions will show up as member functions of the
First, we make an
Interface class instance and tell it to connect to the
>>> from simple_rpc import Interface >>> >>> interface = Interface('/dev/ttyACM0')
We can use the built-in
help() function to see the API documentation of any
>>> help(interface.digital_read) Help on method digital_read: digital_read(pin) method of simple_rpc.simple_rpc.Interface instance Read digital pin. :arg int pin: Pin number. :returns int: Pin value.
All exposed methods can be called like any other class method.
>>> interface.digital_read(8) # Read from pin 8. 0 >>> interface.digital_write(13, True) # Turn LED on.