An exemple for the lib niMQTT

Dependencies:   niMQTT mbed

Revision:
0:db40c618e10c
Child:
2:d42e14112adf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Aug 07 13:42:24 2013 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "rtos.h"
+#include "niMQTT.h"
+#include "EthernetInterface.h"
+
+EthernetInterface eth;
+
+DigitalOut led(LED1);
+DigitalIn pub(p14);
+
+void callback(char *topic, char *message) {
+    printf("==== New PUBLISH received ====\r\n");
+    printf(topic);
+    printf("\r\n------------------------------\r\n");
+    printf(message);
+    printf("\r\n------------ end -------------\r\n");
+}
+
+int main() {
+    printf("\r\n====================================================\r\n");
+    eth.init();
+    do printf("Connection...\r\n"); while (eth.connect() != 0);
+    
+    niMQTT client("10.41.51.53", callback);
+    
+    client.pub("mbed", "Hello World");
+        
+    client.sub("mbed", false);
+    
+    while(true) {
+        if (pub) client.pub("mbed", "test");
+        led = 0;
+        wait(1);
+        led = 1;
+        wait(1);
+    }
+}
\ No newline at end of file