First of all download the base library from the ArduRPC repository and extract the ArduRPC directory into your Arduino library path.
After that you can download additional handlers from the ArduRPC handler repository or from any other source. Copy the handler files to your Arduino library path. Make sure you have downloaded and installed all dependencies before using a handler.
Example: Adafruit_NeoPixel
- Extract the files
- Copy the ArduRPC directory to your Arduino library path
- Extract the files
- Copy the ArduRPC_Adafruit_NeoPixel directory to your Arduino library path
- Extract the files
- Copy the Adafruit_NeoPixel directory to you Arduino library path.
The easiest way to get started is to use one of the available examples and to modify only the required parts.
To use the Adafruit_NeoPixel library with ArduRPC follow the examples below.
1 2 3 4 5 6 7 8 9 | #include <Adafruit_NeoPixel.h>
#include <ArduRPC.h>
#include <ArduRPC_Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(14, 3, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(14, 4, NEO_GRB + NEO_KHZ800);
ArduRPC rpc = ArduRPC(2, 0);
ArduRPCSerial rpc_serial = ArduRPCSerial(Serial, rpc);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | void setup() {
uint8_t handler_id;
strip1.begin();
strip1.show();
handler_id = rpc.connectHandler(rpc_get_neopixel(&strip));
rpc.setHandlerName(handler_id, "neopixel1");
strip2.begin();
strip2.show();
handler_id = rpc.connectHandler(rpc_get_neopixel(&strip2));
rpc.setHandlerName(handler_id, "neopixel2");
}
|
1 2 3 | void loop() {
rpc_serial.loop();
}
|
Some examples are already included in the main ArduRPC library. They can be used to get started.