1- Arduino simpleRPC Python client
2- ===============================
1+ Arduino simpleRPC API client library and CLI
2+ ============================================
33
44.. image :: https://img.shields.io/github/last-commit/jfjlaros/arduino-simple-rpc.svg
55 :target: https://github.com/jfjlaros/arduino-simple-rpc/graphs/commit-activity
@@ -29,53 +29,35 @@ with the simpleRPC_ protocol. The exported method definitions are communicated
2929to the host, which is then able to generate an API interface using this
3030library.
3131
32- Only one function call is needed to perform a remote procedure call.
32+ Features:
33+
34+ - User friendly API library.
35+ - Command line interface (CLI) for method discovery and testing.
36+ - Function and parameter names are defined on the Arduino.
37+ - API documentation is defined on the Arduino.
38+ - Support for disconnecting and reconnecting.
3339
3440Please see ReadTheDocs _ for the latest documentation.
3541
3642
3743Quick start
3844-----------
3945
40- Export any function e.g., ``digitalRead() `` and ``digitalWrite() `` using the
41- ``interface() `` function.
42-
43- .. code :: cpp
44-
45- #include <simpleRPC.h>
46-
47- void setup(void) {
48- Serial.begin(9600);
49- }
46+ Export any function e.g., ``digitalRead() `` and ``digitalWrite() `` on the
47+ Arduino, these functions will show up as member functions of the ``Interface ``
48+ class instance.
5049
51- void loop(void) {
52- interface(digitalRead, "", digitalWrite, "");
53- }
54-
55- These functions are now available on the host under name ``method2() `` and
56- ``method3() ``.
50+ First, we make an ``Interface `` class instance and tell it to connect to the
51+ serial device ``/dev/ttyACM0 ``.
5752
5853.. code :: python
5954
6055 >> > from simple_rpc import Interface
6156 >> >
6257 >> > interface = Interface(' /dev/ttyACM0' )
63- >> >
64- >> > interface.method2(8 )
65- 0
66- >> > interface.method3(13 , True )
6758
68- The documentation string can be used to name and describe the method.
69-
70- .. code :: cpp
71-
72- interface(
73- digitalRead,
74- "digital_read: Read digital pin. @pin: Pin number. @return: Pin value.",
75- digitalWrite,
76- "digital_write: Write to a digital pin. @pin: Pin number. @value: Pin value.");
77-
78- This is reflected on the host.
59+ We can use the built-in ``help() `` function to see the API documentation of any
60+ exported method.
7961
8062.. code :: python
8163
@@ -89,12 +71,16 @@ This is reflected on the host.
8971
9072 :returns int : Pin value.
9173
92- >> > interface.digital_read(8 )
74+ All exposed methods can be called like any other class method.
75+
76+ .. code :: python
77+
78+ >> > interface.digital_read(8 ) # Read from pin 8.
9379 0
94- >> > interface.digital_write(13 , True )
80+ >> > interface.digital_write(13 , True ) # Turn LED on.
9581
9682 For more information about the host library and other interfaces, please see
97- the :doc: `usage ` section .
83+ the :doc: `usage ` and :doc: ` library ` sections .
9884
9985
10086.. _Arduino : https://www.arduino.cc
0 commit comments