Day 6: UDP-Button
In yesterday’s program, the first commands were evaluated by the controller. Today’s program maintains this function but can also additionally send a command into the network independently.
You will find a button behind today’s door. It is used as a simple sensor here. Connect it to the controller as shown in the setup image.
The program: Day6_UDPSwitch
! Attention: Some MAC-Users reportet a bug in the PacketSender-Software. This bug doesn’t allow you to change the ports. If you have problems with this bug you can change the ports in the Arduino program. All you have to do for todays project is to change the line 83 from
succes &= sendCom("AT+CIPSTART=\"UDP\",\"192.168.4.255\",90,91″, "OK");
succes &= sendCom("AT+CIPSTART=\"UDP\",\"192.168.4.255\",5505,5506″, "OK");
The program continues to evaluate the incoming signals. Additionally, the button is continually queried. When the user actuates it, the controller sends the text
to the network. All devices connected to the module with a UDP server on port 90 can receive the command. For a building automation project, a server would receive the status message, e.g. of a motion sensor, and then reset the command led=1 to activate the light.