Get wifi credentials from envvars in example.

This commit is contained in:
Dario Nieuwenhuis 2022-07-21 23:50:40 +02:00
parent 726d68a706
commit 92505f53e2
3 changed files with 7 additions and 4 deletions

View File

@ -12,4 +12,8 @@
"rust-analyzer.linkedProjects": [
"examples/rpi-pico-w/Cargo.toml",
],
"rust-analyzer.server.extraEnv": {
"WIFI_NETWORK": "foo",
"WIFI_PASSWORD": "foo",
}
}

View File

@ -25,8 +25,7 @@ TODO:
- `cargo install probe-run`
- `cd examples/rpi-pico-w`
- Edit `src/main.rs` with your Wifi network's name and password.
- `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

View File

@ -71,8 +71,8 @@ async fn main(spawner: Spawner, p: Peripherals) {
let net_device = control.init(clm).await;
//control.join_open("MikroTik-951589").await;
control.join_wpa2("DirbaioWifi", "HelloWorld").await;
//control.join_open(env!("WIFI_NETWORK")).await;
control.join_wpa2(env!("WIFI_NETWORK"), env!("WIFI_PASSWORD")).await;
let config = embassy_net::ConfigStrategy::Dhcp;
//let config = embassy_net::ConfigStrategy::Static(embassy_net::Config {