Hello, I thought I would share a project I have been working on for work. I’m using a raspberry pi to send commands to an arduino atmega 2560 which either turns on/off relays or takes an analog reading.
The raspberry pi software is written in C++ using QT Creator. It starts through user input then sends single to turn on X relay and sends command to read an analog channel at set increments. When designated time is finished it send command to turn on x relay then kills the timer.
The arduino software is very basic. simple case statement and either reads or turns on/off relay based on command.
DISCLAIMER: Both pieces of code are poorly written. I needed this working immediately so I hacked it to heck and back. I will be cleaning it up soon, but thought this may help somebody wanting to communicate with an arduino using c++ on the raspberry pi.
Thanks for reading, hope this helps someone!
SlotTimer.cpp (12.3 KB)
SlotTimer.h (3.63 KB)
Relay_Command_Control_noUSB.ino (2.89 KB)