Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DISCO_L475VG_IOT01A_wifi
Diff: Wificonnect.cpp
- Revision:
- 3:32b328935a54
- Parent:
- 2:a460007a35c7
- Child:
- 4:33b80026a3ee
--- a/Wificonnect.cpp Wed Aug 21 07:25:27 2019 +0000 +++ b/Wificonnect.cpp Wed Aug 21 08:45:28 2019 +0000 @@ -38,6 +38,8 @@ extern int led_state; extern int T_dust_value; extern int AutoMode; +extern int firstCycle; + void update_state(); Ticker tick; @@ -113,22 +115,32 @@ printf("> ERROR : WIFI Module cannot be initialized.\n"); } - while(1){ + while(1) + { tick.attach(&update_state,1); - if(Socket != -1) { + if(Socket != -1) + { if(WIFI_ReceiveData(Socket, RxData, sizeof(RxData), &Datalen, WIFI_READ_TIMEOUT) == WIFI_STATUS_OK){ - if(Datalen > 0) { + if(Datalen > 0) + { printf("%s \n",RxData); printf("%d \n",motor1_state); Data_Receive(RxData); - if(WIFI_SendData(Socket, TxData, sizeof(TxData), &Datalen, WIFI_WRITE_TIMEOUT) != WIFI_STATUS_OK) { + if(WIFI_SendData(Socket, TxData, sizeof(TxData), &Datalen, WIFI_WRITE_TIMEOUT) != WIFI_STATUS_OK) + { printf("> ERROR : Failed to send Data.\n"); } } - } else { + } + else + { printf("> ERROR : Failed to Receive Data.\n"); } } + if(firstCycle==1) + { + firstCycle=0; + } } }