ECE473/573 (ETCP) Assignment 12
Program 1 (20pts.)
Analyze the provided program entitled
"M2M messaging via Infrastructure and MQTT message broker"
Modify the program so that:
- Create a filter string and initialize it to an empty string.
- If the filter string is empty then
react to the messages "0" and "1" as in the original program.
- If the filter string is not empty then
react only to the "0" and "1" messages sent by the machine that has ID equal to that string.
- When the button is continuously pressed for one or more seconds then
every 0.1 second the board shall be repetitively sending a message with value of "2" instead of "0" OR "1"
until the button is released.
- When the button is continuously pressed for one seconds then
at the exact the one second time reset the filter string.
- When the button is continuously pressed for more than one second
each time you receive a message of "2" store the sender machine ID in the filter string
by overwriting the previous value.
Test the program by:
- Run MQTT Server
either on your laptop or on the lab PC. A portable version can be downloaded and run without setup.
- Modify all MQTT examples to use the IP address of your computer that runs the MQTT server.
- Connect two or more boards and your laptop to an access point.
In case you do not have one, one is provided in the Networked Embedded Lab.
- Run "MQTT traffic injector" either on your laptop or on a lab PC,
this take care of the third or more ESP boards.
- Run "MQTT listener" either on your laptop or on a lab PC.
- Press buttons on the ESP boards for short periods of time. The LEDs should react.
- Do not press any buttons. The LEDs should react to the program running on a PC.
- Press buttons at the same time on the ESP boards for more than one second on both boards.
The LEDs should now react react only between these two boards.
- Press the button for more than one second on one board. That board should start responding to the PC
program while the other board should still have an active filter.
- More thorough testing with several pairings and forgetting among more than two boards is desired.
However, you may have only two boards available and the movie documenting the test can be too large.
Submission
Record your test of the project using a phone camera and submit that movie on Canvas.