MQTT example using the Freescale FRDM-K64F platform without additional hardware.

Dependencies:   EthernetInterface MQTT mbed-rtos mbed

This is a simple MQTT demo that does the following:

- connect/disconnect to the MQTT Dashboard public broker (broker.mqttdashboard.com)

- subscribe to a user-defined MQTT topic

- publish messages from the FRDM-K64F board when SW2 or SW3 is pressed

- receive messages from a web dashboard client to change the color of the LED

- send serial output regarding connection status and MQTT messages sent/received

The web client code can be found at the following URL:

https://github.com/msbaylis/frdm-k64f-mqtt-dashboard.git

NOTE: make sure you change the #defines in main.cpp to specify your client ID and MQTT topic. I used the MAC address of my FRDM-K64F board without colons for the client ID. Assuming you're board is properly connected to a network, the serial output should display info including the board's MAC address.

Committer:
msbaylis
Date:
Wed Feb 10 18:39:26 2016 +0000
Revision:
0:9796509d718e
Initial committ

Who changed what in which revision?

UserRevisionLine numberNew contents of line
msbaylis 0:9796509d718e 1 #ifndef K64F_H_
msbaylis 0:9796509d718e 2 #define K64F_H_
msbaylis 0:9796509d718e 3
msbaylis 0:9796509d718e 4 typedef enum color {off, red, green, blue} color_t;
msbaylis 0:9796509d718e 5
msbaylis 0:9796509d718e 6 Serial pc(USBTX, USBRX);
msbaylis 0:9796509d718e 7 DigitalOut redLED(LED_RED);
msbaylis 0:9796509d718e 8 DigitalOut greenLED(LED_GREEN);
msbaylis 0:9796509d718e 9 DigitalOut blueLED(LED_BLUE);
msbaylis 0:9796509d718e 10 InterruptIn switch2(SW2);
msbaylis 0:9796509d718e 11 InterruptIn switch3(SW3);
msbaylis 0:9796509d718e 12
msbaylis 0:9796509d718e 13 #endif // K64F.H