Hi guys I have a laboratory monitoring sensor system project which involves multiple humidity and temperature sensors hooked up to an arduino. There are three stations in the system:
main station is an arduino mega with a xbee module, TFT LCD touch screen and a DHT22 sensor connected
1st station is an arduino uno with a xbee module and a Dallas DS18B20 sensor connected to it
2nd station is an arduino uno with a xbee module a DHT22 sensor and DS18B20 sensor
Basically, I got the main station and 1st station communicating properly via the Xbee modules in API mode. I will add the 2nd station in the same configuration in the future. Basically, the TFT LCD screen is connected to the arduino mega via I2C. The communication between the TFT and the Arduino is functioning properly. My issue now is that I would like to know how to detect a string coming in the I2C bus on the Arduino mega and then perform an action/function based on it.
For example:
The user has pressed a button to change the monitor frequency of the system for the main station so the string "MON,500" will be sent via the I2C bus. The Arduino will scan the string and detect "MON" then call the appropriate function for it and then use the value after the comma as the monitor frequency value (possibly store it in the appropriate int variable).
I know that the strtok() function can be used to separate strings by detecting delimiters but I am not sure how to implement the above situation on Arduino. Thanks and Regards to everyone.