Git Product home page Git Product logo

mbed-os-example-wifi's Introduction

mbed-os-example-wifi

Wi-Fi example for Mbed OS

(Note: To see this example in a rendered form you can import into the Arm Mbed Online Compiler, please see the documentation.)

Getting started with the Wi-Fi API

This is an example of a Wi-Fi application using the Wi-Fi APIs that Mbed OS provides.

The program brings up the Wi-Fi and the underlying network interface and uses it to scan available networks, connects to a network and prints interface and connection details.

For more information about Wi-Fi APIs, please visit the Mbed OS Wi-Fi documentation.

Supported hardware

Adding connectivity driver

If the target does not have internal WiFi driver, or Mbed OS does not supply one, you need to add driver to your application and configure it to provide default WiFi interface.

mbed add <driver>

For example adding ISM43362 driver mbed add wifi-ism43362 or X-Nucleo-IDW01M1 driver mbed add wifi-x-nucleo-idw01m1 The ESP8266 driver is already suplied by Mbed OS.

Then pin names need to be configured as instructed in the drivers README file.

Getting started

  1. Import the example.

    mbed import mbed-os-example-wifi
    cd mbed-os-example-wifi
    
  2. Configure the Wi-Fi shield and settings. Edit mbed_app.json to include the correct Wi-Fi shield, SSID and password:

{
    "config": {
        "wifi-ssid": {
            "help": "WiFi SSID",
            "value": "\"SSID\""
        },
        "wifi-password": {
            "help": "WiFi Password",
            "value": "\"PASSWORD\""
        }
    },
    "target_overrides": {
        "*": {
            "platform.stdio-convert-newlines": true,
            "esp8266.provide-default" : false
        }
    }
}

For build-in WiFi, you do not need to set any provide-default values. Those are required if you use external WiFi shield.

Sample mbed_app.json files are provided for ESP8266 (mbed_app_esp8266.json), X-NUCLEO-IDW04A1 (mbed_app_idw04a1.json) and X-NUCLEO-IDW01M1 (mbed_app_idw01m1).

  1. Compile and generate binary. For example, for GCC:

    mbed compile -t GCC_ARM -m UBLOX_EVK_ODIN_W2
    
  2. Open a serial console session with the target platform using the following parameters:

    • Baud rate: 9600
    • Data bits: 8
    • Stop bits: 1
    • Parity: None
  3. 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.

  4. The serial console should display a similar output to below, indicating a successful Wi-Fi connection:

    WiFi example
    
    Scan:
    Network: Dave Hot Spot secured: Unknown BSSID: 00:01:02:03:04:05 RSSI: -58 Ch: 1
    1 network available.
    
    Connecting...
    Success
    
    MAC: 00:01:02:03:04:05
    IP: 192.168.0.5
    Netmask: 255.255.255.0
    Gateway: 192.168.0.1
    RSSI: -27
    
    Done
    

Troubleshooting

If you have problems, you can review the documentation for suggestions on what could be wrong and how to fix it.

License and contributions

The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info.

This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.

mbed-os-example-wifi's People

Contributors

0xc0170 avatar adbridge avatar adustm avatar betzw avatar bulislaw avatar c1728p9 avatar cmonr avatar dhwalters423 avatar janjongboom avatar jeromecoutant avatar marcelosalazar avatar michalpasztamobica avatar sarahmarshy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.