Update examples in README.md

This commit is contained in:
Olivier Monnom 2023-05-24 09:22:05 +02:00 committed by GitHub
parent a3d6aa5d7d
commit a19f8c32ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,27 +21,28 @@ TODO:
- Setting a custom MAC address. - Setting a custom MAC address.
- Bus sleep (unclear what the benefit is. Is it needed for IRQs? or is it just power consumption optimization?) - Bus sleep (unclear what the benefit is. Is it needed for IRQs? or is it just power consumption optimization?)
## Running the example ## Running the examples
- `cargo install probe-rs-cli` - `cargo install probe-rs-cli`
- `cd examples/rpi-pico-w` - `cd examples/rpi-pico-w`
### Example 1: Scan the wifi stations
- `cargo run --release --bin wifi_scan`
### Example 2: Create an access point (IP and credentials in the code)
- `cargo run --release --bin tcp_server_ap`
### Example 3: Connect to an existing network and create a server
- `WIFI_NETWORK=MyWifiNetwork WIFI_PASSWORD=MyWifiPassword cargo run --release` - `WIFI_NETWORK=MyWifiNetwork WIFI_PASSWORD=MyWifiPassword cargo run --release`
After a few seconds, you should see that DHCP picks up an IP address like this After a few seconds, you should see that DHCP picks up an IP address like this
``` ```
11.944489 DEBUG Acquired IP configuration: 11.944489 DEBUG Acquired IP configuration:
11.944517 DEBUG IP address: 192.168.0.250/24 11.944517 DEBUG IP address: 192.168.0.250/24
11.944620 DEBUG Default gateway: 192.168.0.33 11.944620 DEBUG Default gateway: 192.168.0.33
11.944722 DEBUG DNS server 0: 192.168.0.33 11.944722 DEBUG DNS server 0: 192.168.0.33
``` ```
This example implements a TCP echo server on port 1234. You can try connecting to it with:
The example implements a TCP echo server on port 1234. You can try connecting to it with:
``` ```
nc 192.168.0.250 1234 nc 192.168.0.250 1234
``` ```
Send it some data, you should see it echoed back and printed in the firmware's logs. Send it some data, you should see it echoed back and printed in the firmware's logs.
## License ## License