MQTT Client for Kakao IoT chatbot lecture.
Dependencies: DHT MQTT WIZnetInterface mbed
Fork of openHAB_mqtt_W7500 by
Revision 19:8f5ab618edd0, committed 2017-11-12
- Comitter:
- bangbh
- Date:
- Sun Nov 12 13:34:56 2017 +0000
- Parent:
- 18:44a64786f3ca
- Commit message:
- io changed
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 44a64786f3ca -r 8f5ab618edd0 main.cpp --- a/main.cpp Sun Nov 12 11:36:25 2017 +0000 +++ b/main.cpp Sun Nov 12 13:34:56 2017 +0000 @@ -9,9 +9,9 @@ int arrivedcount = 0; -DigitalOut sw1(D9); -DigitalOut sw2(D10); -DigitalOut sw3(D11); +DigitalOut sw1(PC_08); +DigitalOut sw2(PC_09); +DigitalOut sw3(PC_05); void sw1_messageArrived(MQTT::MessageData& md) @@ -54,17 +54,11 @@ } int main (void) -{ - DHT sensor(D4, DHT11); - DigitalOut myled(LED1); - +{ sw1 = 0; sw2 = 0; sw3 = 0; baud(115200); printf("Wait a second...\r\n"); - - myled = 0; - MQTTEthernet ipstack = MQTTEthernet(); printf("IP Address : %s\r\n",ipstack.getEth().getIPAddress()); MQTT::Client<MQTTEthernet, Countdown> client = MQTT::Client<MQTTEthernet, Countdown>(ipstack); @@ -99,7 +93,7 @@ char *sw1 = "light/control"; - if ((rc = client.subscribe(sw1, MQTT::QOS1, sw1_messageArrived)) != 0) + if ((rc = client.subscribe(sw1, MQTT::QOS0, sw1_messageArrived)) != 0) { printf("rc from MQTT subscribe is %d\r\n", rc); return 0; @@ -107,7 +101,7 @@ printf("Added subscription for sw1\r\n"); char *sw2 = "boiler/control"; - if ((rc = client.subscribe(sw2, MQTT::QOS1, sw2_messageArrived)) != 0) + if ((rc = client.subscribe(sw2, MQTT::QOS0, sw2_messageArrived)) != 0) { printf("rc from MQTT subscribe is %d\r\n", rc); return 0; @@ -115,7 +109,7 @@ printf("Added subscription for sw2\r\n"); char *sw3 = "radio/control"; - if ((rc = client.subscribe(sw3, MQTT::QOS1, sw3_messageArrived)) != 0) + if ((rc = client.subscribe(sw3, MQTT::QOS0, sw3_messageArrived)) != 0) { printf("rc from MQTT subscribe is %d\r\n", rc); return 0;