Projet IoT - Fire Detector CS

Dependencies:   BSP_B-L475E-IOT01

Committer:
GuilhermeLubk
Date:
Tue Oct 13 12:46:38 2020 +0000
Revision:
1:2c451ce6086b
Parent:
0:e84b46bbec77
New member : Buzzer;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GuilhermeLubk 0:e84b46bbec77 1 # mbed-os-example-wifi #
GuilhermeLubk 0:e84b46bbec77 2
GuilhermeLubk 0:e84b46bbec77 3 Wi-Fi example for Mbed OS
GuilhermeLubk 0:e84b46bbec77 4
GuilhermeLubk 0:e84b46bbec77 5 ## Getting started with the Wi-Fi API ##
GuilhermeLubk 0:e84b46bbec77 6
GuilhermeLubk 0:e84b46bbec77 7 This is an example of a Wi-Fi application using the Wi-Fi and network socket APIs that [Mbed OS](https://github.com/ARMmbed/mbed-os) provides.
GuilhermeLubk 0:e84b46bbec77 8
GuilhermeLubk 0:e84b46bbec77 9 The program brings up the Wi-Fi and the underlying network interface and uses it to scan available networks, connects to a network, prints interface and connection details and performs an HTTP operation.
GuilhermeLubk 0:e84b46bbec77 10
GuilhermeLubk 0:e84b46bbec77 11 For more information about Wi-Fi APIs, please visit the [Mbed OS Wi-Fi](https://os.mbed.com/docs/latest/reference/wi-fi.html) documentation.
GuilhermeLubk 0:e84b46bbec77 12
GuilhermeLubk 0:e84b46bbec77 13 ### Supported hardware ###
GuilhermeLubk 0:e84b46bbec77 14
GuilhermeLubk 0:e84b46bbec77 15 * [NUCLEO-F401RE](https://os.mbed.com/platforms/ST-Nucleo-F401RE/) with [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html) Wi-Fi expansion board using pins D8 and D2 _(of the Arduino connector)_.
GuilhermeLubk 0:e84b46bbec77 16 * [NUCLEO-F401RE](https://os.mbed.com/platforms/ST-Nucleo-F401RE/) with [X-NUCLEO-IDW01M1](https://os.mbed.com/components/X-NUCLEO-IDW01M1/) Wi-Fi expansion board using pins PA_9 and PA_10 _(of the Morpho connector)_.
GuilhermeLubk 0:e84b46bbec77 17 * [DISCO_L475VG_IOT01A](https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/) with ISM43362 built-in module
GuilhermeLubk 0:e84b46bbec77 18 * [DISCO_F413ZH](https://os.mbed.com/platforms/ST-Discovery-F413H/) with ISM43362 built-in module
GuilhermeLubk 0:e84b46bbec77 19 * Other Mbed targets with [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html) or [X-NUCLEO-IDW01M1](https://os.mbed.com/components/X-NUCLEO-IDW01M1/) expansion board.
GuilhermeLubk 0:e84b46bbec77 20 *(The Mbed target board the Wi-Fi shield connects to shouldn't have any other network interface, for example Ethernet.)*
GuilhermeLubk 0:e84b46bbec77 21
GuilhermeLubk 0:e84b46bbec77 22 #### Connecting the X-NUCLEO-IDW0XX1 ####
GuilhermeLubk 0:e84b46bbec77 23
GuilhermeLubk 0:e84b46bbec77 24 To connect the [X-NUCLEO-IDW04A1](http://www.st.com/content/st_com/en/products/ecosystems/stm32-open-development-environment/stm32-nucleo-expansion-boards/stm32-ode-connect-hw/x-nucleo-idw04a1.html) or [X-NUCLEO-IDW01M1](https://developer.mbed.org/components/X-NUCLEO-IDW01M1/) expansion board to your NUCLEO development board, plug the expansion board on top of the NUCLEO board using the Arduino or Morpho connector.
GuilhermeLubk 0:e84b46bbec77 25
GuilhermeLubk 0:e84b46bbec77 26 ## Getting started ##
GuilhermeLubk 0:e84b46bbec77 27
GuilhermeLubk 0:e84b46bbec77 28 1. Import the example.
GuilhermeLubk 0:e84b46bbec77 29
GuilhermeLubk 0:e84b46bbec77 30 ```
GuilhermeLubk 0:e84b46bbec77 31 mbed import mbed-os-example-wifi
GuilhermeLubk 0:e84b46bbec77 32 cd mbed-os-example-wifi
GuilhermeLubk 0:e84b46bbec77 33 ```
GuilhermeLubk 0:e84b46bbec77 34
GuilhermeLubk 0:e84b46bbec77 35 2. Configure the Wi-Fi shield to use.
GuilhermeLubk 0:e84b46bbec77 36
GuilhermeLubk 0:e84b46bbec77 37 Edit ```mbed_app.json``` to include the correct Wi-Fi shield, SSID and password:
GuilhermeLubk 0:e84b46bbec77 38
GuilhermeLubk 0:e84b46bbec77 39 ```
GuilhermeLubk 0:e84b46bbec77 40 "config": {
GuilhermeLubk 0:e84b46bbec77 41 "wifi-shield": {
GuilhermeLubk 0:e84b46bbec77 42 "help": "Options are WIFI_IDW0XX1",
GuilhermeLubk 0:e84b46bbec77 43 "value": "WIFI_IDW0XX1"
GuilhermeLubk 0:e84b46bbec77 44 },
GuilhermeLubk 0:e84b46bbec77 45 "wifi-ssid": {
GuilhermeLubk 0:e84b46bbec77 46 "help": "WiFi SSID",
GuilhermeLubk 0:e84b46bbec77 47 "value": "\"SSID\""
GuilhermeLubk 0:e84b46bbec77 48 },
GuilhermeLubk 0:e84b46bbec77 49 "wifi-password": {
GuilhermeLubk 0:e84b46bbec77 50 "help": "WiFi Password",
GuilhermeLubk 0:e84b46bbec77 51 "value": "\"Password\""
GuilhermeLubk 0:e84b46bbec77 52 }
GuilhermeLubk 0:e84b46bbec77 53 },
GuilhermeLubk 0:e84b46bbec77 54 ```
GuilhermeLubk 0:e84b46bbec77 55
GuilhermeLubk 0:e84b46bbec77 56 Sample ```mbed_app.json``` files are provided for X-NUCLEO-IDW04A1 (```mbed_app_idw04a1.json```), X-NUCLEO-IDW01M1 (```mbed_app_idw01m1```), DISCO_L475VG_IOT01A/ISM43362 (```mbed_app_ism43362.json```) and DISCO_F413ZH/ISM43362 (```mbed_app_ism43362.json```)
GuilhermeLubk 0:e84b46bbec77 57
GuilhermeLubk 0:e84b46bbec77 58 For built-in Wi-Fi, ignore the value of `wifi-shield`.
GuilhermeLubk 0:e84b46bbec77 59
GuilhermeLubk 0:e84b46bbec77 60 3. Compile and generate binary.
GuilhermeLubk 0:e84b46bbec77 61
GuilhermeLubk 0:e84b46bbec77 62 For example, for `GCC`:
GuilhermeLubk 0:e84b46bbec77 63
GuilhermeLubk 0:e84b46bbec77 64 ```
GuilhermeLubk 0:e84b46bbec77 65 mbed compile -t GCC_ARM -m UBLOX_EVK_ODIN_W2
GuilhermeLubk 0:e84b46bbec77 66 ```
GuilhermeLubk 0:e84b46bbec77 67
GuilhermeLubk 0:e84b46bbec77 68 4. Open a serial console session with the target platform using the following parameters:
GuilhermeLubk 0:e84b46bbec77 69
GuilhermeLubk 0:e84b46bbec77 70 * **Baud rate:** 9600
GuilhermeLubk 0:e84b46bbec77 71 * **Data bits:** 8
GuilhermeLubk 0:e84b46bbec77 72 * **Stop bits:** 1
GuilhermeLubk 0:e84b46bbec77 73 * **Parity:** None
GuilhermeLubk 0:e84b46bbec77 74
GuilhermeLubk 0:e84b46bbec77 75 5. Copy or drag the application `mbed-os-example-wifi.bin` in the folder `mbed-os-example-wifi/BUILD/<TARGET NAME>/<PLATFORM NAME>` onto the target board.
GuilhermeLubk 0:e84b46bbec77 76
GuilhermeLubk 0:e84b46bbec77 77 6. The serial console should display a similar output to below, indicating a successful Wi-Fi connection:
GuilhermeLubk 0:e84b46bbec77 78
GuilhermeLubk 0:e84b46bbec77 79 ```
GuilhermeLubk 0:e84b46bbec77 80 WiFi example
GuilhermeLubk 0:e84b46bbec77 81
GuilhermeLubk 0:e84b46bbec77 82 Scan:
GuilhermeLubk 0:e84b46bbec77 83 Network: Dave Hot Spot secured: Unknown BSSID: 00:01:02:03:04:05 RSSI: -58 Ch: 1
GuilhermeLubk 0:e84b46bbec77 84 1 network available.
GuilhermeLubk 0:e84b46bbec77 85
GuilhermeLubk 0:e84b46bbec77 86 Connecting...
GuilhermeLubk 0:e84b46bbec77 87 Success
GuilhermeLubk 0:e84b46bbec77 88
GuilhermeLubk 0:e84b46bbec77 89 MAC: 00:01:02:03:04:05
GuilhermeLubk 0:e84b46bbec77 90 IP: 192.168.0.5
GuilhermeLubk 0:e84b46bbec77 91 Netmask: 255.255.255.0
GuilhermeLubk 0:e84b46bbec77 92 Gateway: 192.168.0.1
GuilhermeLubk 0:e84b46bbec77 93 RSSI: -27
GuilhermeLubk 0:e84b46bbec77 94
GuilhermeLubk 0:e84b46bbec77 95 Sending HTTP request to www.arm.com...
GuilhermeLubk 0:e84b46bbec77 96 sent 38 [GET / HTTP/1.1]
GuilhermeLubk 0:e84b46bbec77 97 recv 64 [HTTP/1.1 301 Moved Permanently]
GuilhermeLubk 0:e84b46bbec77 98
GuilhermeLubk 0:e84b46bbec77 99 Done
GuilhermeLubk 0:e84b46bbec77 100 ```
GuilhermeLubk 0:e84b46bbec77 101
GuilhermeLubk 0:e84b46bbec77 102 ## Troubleshooting
GuilhermeLubk 0:e84b46bbec77 103
GuilhermeLubk 0:e84b46bbec77 104 If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.