So I have 2 sensors connected to my Arduino and am sending the data through serial. I want the Pi to use both values differently. I am trying to make a gui where the values are displayed as such " First sensor data = value 1....Second Sensor data = value 2". I have seen other threads but they don't cover values from two different source. Do help!
I suggest you format each serial message as follows.
0x00 length_byte type_byte data_bytes checksum_byte 0xff
and assign a different
type_byte value for each type of message you wish to send.
The header (
0x00) and trailer (
0xff) bytes will let you re-sync if the Arduino and Pi get out of sync. The
checksum_byte may be used to ensure message integrity. The
length_byte will let you send messages of varying length.
Don't reinvent the wheel by making your own protocol. You can do this buy putting the Firmata firmware on the Arduino (part of the arduino examples collection) then using a firmata client.
I recommend node-red (nodered.org), which is already present in Raspbian, as a solution for both the firmata client and the dashboard.