Connect through Wifi to IBM MQTT cloud https://quickstart.internetofthings.ibmcloud.com
Dependencies: MQTT NetworkSocketAPI X_NUCLEO_IDW01M1v2 X_NUCLEO_IKS01A1 mbed NDefLib X_NUCLEO_NFC01A1
Fork of IDW01M1_Cloud_IBM by
To start the demo the following expansion boards are required
X_NUCLEO_IDW01M1v2, X_NUCLEO_IKS01A1, X_NUCLEO_NFC01A1
After having mounted the board stack on the Nucleo board the below steps should be followed:
- Program in the application source code you local WiFi SSID and password and flash the binary. Make sure the Wifi network has visible SSID.
- Reset the Nucleo board and after few seconds the Nucleo green led will be on (it means the Nucleo is connected to the local Wifi and to the IBM cloud server)
- Read the NFC tag with an Android device and the browser will be automatically opened and directed to the specific brocker IBM demo page where the environmental values are displayed in form of a x-y graph. The values are updated every few seconds. On the Hyperterminal is possible to see the values sent to the IBM cloud server and the board mac address to be entered on the IBM quickstart web page if a manual connection is needed (eg. to connect from a PC browser).
Revision 1:041e9f05738c, committed 2016-04-12
- Comitter:
- mridup
- Date:
- Tue Apr 12 09:26:56 2016 +0000
- Parent:
- 0:cbf8bc43bc9e
- Child:
- 2:ba0531d896f0
- Commit message:
- Optimization changes and other misc.
Changed in this revision
--- a/X_NUCLEO_IDW01M1/WIFI_API/x-nucleo-idw01m1.cpp Fri Apr 08 12:07:17 2016 +0000 +++ b/X_NUCLEO_IDW01M1/WIFI_API/x-nucleo-idw01m1.cpp Tue Apr 12 09:26:56 2016 +0000 @@ -108,7 +108,7 @@ if (timer.read_ms() > _timeout) { return -1; } - asm("NOP"); + __NOP(); } return 0; @@ -132,7 +132,7 @@ if (timer.read_ms() > _timeout) { return -1; } - asm("NOP"); + __NOP(); } return 0; @@ -228,7 +228,7 @@ if(bytes_read==0) return -1;//return error if no bytes are read! return bytes_read;//return amount of data arrived so far } - asm("NOP"); + __NOP(); } return bytes_read;
--- a/main.cpp Fri Apr 08 12:07:17 2016 +0000 +++ b/main.cpp Tue Apr 12 09:26:56 2016 +0000 @@ -12,8 +12,8 @@ DigitalOut myled(LED1); SpwfSAInterface *spwf; -TCPSocket *tcp_; - +TCPSocket *tcp_; + int main() { int32_t err; char * ssid = "STM"; @@ -26,14 +26,14 @@ spwf = createSPWFInstance(); tcp_ = new TCPSocket(spwf); - + err = spwf->init(); if(err!=0) { pc.printf("\r\n[APP] error initializing.\r\n"); return -1; } - + pc.printf("\r\n[APP] connecting to AP\r\n"); err = spwf->connect(ssid, seckey, NS_SECURITY_WPA); @@ -79,6 +79,7 @@ } else pc.printf("\r\n[APP] socket open Error\r\n"); + while(1) { wait(1); @@ -86,4 +87,3 @@ myled = !myled; } } - \ No newline at end of file
--- a/mbed-src-hwflw.lib Fri Apr 08 12:07:17 2016 +0000 +++ b/mbed-src-hwflw.lib Tue Apr 12 09:26:56 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/mridup/code/mbed-src-hwflw/#1b0c4e3233d7 +https://developer.mbed.org/users/mridup/code/mbed-src-hwflw/#ac862d1afbdb