Simple demo with GPIO MQTT protocol test on STM32 broker tests.mosquitto.org WIFI interface ESP8266 Issue of topic0 by pressing the button If reception of ', switching of the led If received from 'q' end of program
This is a MQTT protocol test on STM32 NUCLEO The broker is tests.mosquitto.org The WIFI interface is ESP8266
For configuration please check mbed_app.json and #define in main.cpp
Issue of topic0 by pressing the button If received 'l' from broker then switching of the led If received 'q' from broker then end the program
Information and debug with a terminal using UART over USB
This test has been checked with MQTT.fx
Diff: main.cpp
- Revision:
- 1:a1d5c7a6acbc
- Parent:
- 0:0cae29831d01
- Child:
- 2:638c854c0695
diff -r 0cae29831d01 -r a1d5c7a6acbc main.cpp --- a/main.cpp Tue Feb 04 22:38:15 2014 +0000 +++ b/main.cpp Wed Feb 05 10:50:15 2014 +0000 @@ -1,10 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2014 IBM Corp. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Ian Craggs - initial API and implementation and/or initial documentation + *******************************************************************************/ + #include "mbed.h" #include "EthernetInterface.h" #include "C12832_lcd.h" #include "MQTTPacket.h" - DigitalOut myled(LED2); C12832_LCD lcd; @@ -53,13 +68,15 @@ return 0; } -int main() { +int main() +{ EthernetInterface eth; eth.init(); //Use DHCP eth.connect(); lcd.printf("IP Address is %s\n", eth.getIPAddress()); - while(1) { + while(1) + { myled = 1; publish(); wait(0.2);