HuyNQ

Dependencies:   C12832 MQTT_MbedOS

Fork of mbed-os-mqtt by Daniel Knox

Files at this revision

API Documentation at this revision

Comitter:
kokichi226
Date:
Thu Nov 02 09:59:26 2017 +0000
Parent:
1:8d33e7fdd27c
Commit message:
Fix Printf

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Nov 02 09:39:32 2017 +0000
+++ b/main.cpp	Thu Nov 02 09:59:26 2017 +0000
@@ -1,10 +1,7 @@
 #include "mbed.h"
-#include "C12832.h"
 #include "MQTTEthernet.h"
 #include "MQTTClient.h"
 
-// LCD Pinout
-C12832 lcd(D11, D13, D12, D7, D10);
 
 // MQTT Variables
 char* MqttHostname = "192.168.1.105";
@@ -15,14 +12,14 @@
 int main()
 {
     
-    printf("Example MQTT client\n");
+    printf("Example MQTT client\r\n");
 
     // Brings up the network interface
     MQTTEthernet eth = MQTTEthernet();
     const char *ip = eth.get_ip_address();
     
     
-    printf("IP address is: %s\n", ip ? ip : "No IP");
+    printf("IP address is: %s\r\n", ip ? ip : "No IP");
     
     // Create Mbed Client Interface
     MQTT::Client<MQTTEthernet, Countdown> client = MQTT::Client<MQTTEthernet, Countdown>(eth);
@@ -30,7 +27,7 @@
     // Create TCP connection
     eth.open(eth.getEth());
     int rc = eth.connect(MqttHostname, MqttPort);
-    printf("TCP Status: %s\n", (rc == 0) ? "Success" : "Failure");
+    printf("TCP Status: %s\r\n", (rc == 0) ? "Success" : "Failure");
     
     // Wait for a short length of time to allow user to see output messages.
     Thread::wait(2000);
@@ -46,7 +43,7 @@
         rc = client.connect(data);
         
         
-        printf("MQTT Client: %s\n", (rc == 0) ? "Connected" : "Failed");
+        printf("MQTT Client: %s\r\n", (rc == 0) ? "Connected" : "Failed");
         
         while(rc == 0){
             MQTT::Message message;