Independent libraries for communication between arduino and Raspberry Pi

Hello,

I have a C++ based project on a Raspberry Pi. I need to extend my framework to read data from Arduino micro via USB port.
Unfortunately, I cannot move my entire framework to the Arduino Sketch since the project is huge. Are there some independent (portable) libraries that can help the Raspberry Pi communicate to the Arduino Micro?

firmata is include in the IDE File | Examples | Firmata. The host computer can read/write analog/digital pins of the Arduino board. There is probably generic c/c++ code for the host side of the protocol but you will have to some digging with google.

https://www.arduino.cc/en/Reference/Firmata

anroidpcc:
I have a C++ based project on a Raspberry Pi. I need to extend my framework to read data from Arduino micro via USB port.
Unfortunately, I cannot move my entire framework to the Arduino Sketch since the project is huge. Are there some independent (portable) libraries that can help the Raspberry Pi communicate to the Arduino Micro?

I can’t figure out what you want to do or why you think you need a library. Why can’t your RPi talk to an Arduino over a Serial connection? That is very straightforward.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

This Python - Arduino demo may also give you some ideas. It should not be difficult to convert the Python code to C++

…R