- nanopb
- Download and unzip to
ext
. Rename tonanopb
- OSX:
sudo easy_install pip; and sudo python -m pip install protobuf
- Download and unzip to
- Setup protocol buffers for go
- Sketch -> Include Library -> Add .ZIP library
- Select
nanopb
folder
- Select
- Sketch -> Include Library -> nanopb
gcc -I ../ext/nanopb/ ../ext/nanopb/pb_decode.c ../ext/nanopb/pb_common.c led.pb.c proto.c proto_test.c
#!/bin/bash
./a.out $(echo 'led_string: {leds: {color: BLACK}}' | ./bin/protoc --encode ControlMessage led.proto)
echo 'led_string: {leds: {color: RED}, leds: {color: BLUE}}' | ./bin/protoc --encode ControlMessage led.proto | ./bin/protoc --decode ControlMessage led.proto
While developing: ./bin/protoc led.proto -o led.pb
- Assuming protoc has been extracted in
proto
directory
For Arduino:
- source
python ext/nanopb/generator/nanopb_generator.py proto/led.pb
- Assuming nanopb is in ext/nanopb