Hi, I am using 3 Arduinos all on on I2C bus to control an espresso machine.
The master is running a menu system and displaying to a Nokia 3310 display.
Slave 1 is read a thermistor and running a PID algorithm to control the boiler temp.
Slave 2 is reading the state of the brew switch and reading a load cell.
Currently, the master reads the PID Setpoint and Output, as well as the load cell mass once every second and writes the values to the Serial Window.
What I want to do is be able to change the PID Setpoint in the menu (Master) and write that to Slave 1. I also want to read the brew switch (Slave 2) and if it is ON change the Output of the PID algorithm in Slave 1 to maximum.
I have the menu set up so I can change values for the boiler temp (Master), but I am a bit confused in the writing to Slave 1.
Since at different times I want to write either the new Setpoint OR the Output to Slave 1, and the Output and Setpoint data types are both doubles, how can Slave 1 differentiate between them when it is reading them in?
If I am writing a new Setpoint, I don't want to mess with the PID Output, and if I am driving the PID Output to maximum temporarily while I pull a shot, I don't want to mess with the PID Setpoint.
Can anyone please suggest how can I achieve this?