TCPClient_Receive(byte TCPBytesReceivedBuffer) The MQTT server, for example responds to a connect-request with a byte sequence ‘32 2 0 0’, when the connection request has been successful and you can then go on to publish messages. Also not evaluated yet are the incoming TCP/IP messages from the server. I was already aware of some basic error handling: The ESP8266, for example returns ‘ERROR’ when a TCP/IP link could not be established. Here it periodically measures the light level provided by the phototransistor and supplies the ESP8266 with the AT commands to establish a TCP/IP connection to a HiveMQ test server via the Internet a MQTT connect request is then sent followed by MQTT publish command (using the measured light-level value as the payload). By pressing the button the ATmega is configured to sensor mode. On power up the ESP8266 logs onto a Wi-Fi network and when this link is established the RGB LED lights up green. I added a phototransistor, a pushbutton to initiate actions and an RGB LED to provide status information. In the last installment of my journey I built a small sensor board based on the Pretzel Board (which comes with an on-board ATmega and ESP8266 Wi-Fi chip) and available to order from the Elektor shop.
0 Comments
Leave a Reply. |