Community

WiFi Networking

Now that I am back behind the wheel of a working Meadow, I am also back to trying to connect to my WiFi router.

Does anyone have any sort of sample code for connecting? And how does one go about connecting to a network that is secured by a password?

I have been through some of the samples on Hackster.io, but found nothing.

Thanks in advance,
Woody

There is a Networking Section on the Developer site.

Regards,
Mark

Mark,
Thank you for the quick response. I found the page, but InitWiFiAdapter() doesn’t appear in the list of options in VS after I type ‘Device.’, and my code won’t compile with Error

‘F7Micro’ does not contain a definition for ‘InitWiFiAdapter’…

Looking at my list of packages, I am running Meadow.Foundation(0.15.2) and Meadow(0.13.0).

I am obviously missing a dependency.

Thanks again,
Woody

some additional information.
I decided to un-install the meadow extension, download and install the latest meadow package, version 0.11.0

I then erased the flash on the meadow and tried to re-flash, which produces this output.

[9/24/2020 11:10:17 AM] Begin ‘Flash Device’
[9/24/2020 11:10:17 AM] Upload Meadow.OS.bin (~2 mins)
[9/24/2020 11:11:26 AM] Initialize device
[9/24/2020 11:11:26 AM] An unexpected error occurred. Please try again.

I received this particular Meadow on Monday, September 21, and had successfully flashed the OS, and was able to run a variant on the LED Dice that I had been using to try to connect to my WiFi network.

I have tried re-flashing without erasing the flash and with erasing the flash multiple times, getting the same error each time. And my Dice application does not load with errors

1>------ Build started: Project: leddice, Configuration: Debug Any CPU ------
1>leddice -> C:\Users\wlath\source\repos\leddice\leddice\bin\Debug\net472\App.exe
2>------ Deploy started: Project: leddice, Configuration: Debug Any CPU ------
2>[9/24/2020 11:28:09 AM] Deploying to Meadow on COM4…
2>[9/24/2020 11:28:09 AM] Initializing Meadow 2>[9/24/2020 11:28:09 AM] Couldn’t initialize serial port 2>Failed to initialize Meadow. Try resetting or reconnecting the device.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

which is actually what I expected.
I seem to be marching backward

Woody

The problem seems to have been that I did not correctly manage the nuget packages within my application, so originally I was just running an earlier version of the Meadow.Foundation, even though I had downloaded the latest package in the package manager.

The fix was to remove all of the nuget packages and re-add them. I assume that the problem that I was having with flashing the Meadow OS had to do with having something out of sync, although sadly I don’t know what that would have been.

I am now able to initialize my WiFi Adapter. I haven’t been able to connect yet.

Woody

Still trying to connect. The adapter initialization is a waitable process. Seems as though the connection process should also be waitable, but it is not.

The connection code from the web page only ever produces an “UnspecifiedFailure”, immediately, so I put a loop after the connect statement to see if the connection would eventually be made, but at the end of 120 seconds, nothing.

I tried to connect using both my SSID /passcode, and a WiFiNetwork object / passcode.
I tried it with several different networks, both secure and open, both with passcodes and without. Always the same result.

I guess that I need more than what is in the documents to get my Meadow connected.

thanks,
Woody

I’ve got the same, exact problem. Followed the documentation available in the Networking section of the developer site, with the following code:

public MeadowApp()
{
  Console.WriteLine("Initializing WiFi adapter.");
  Device.InitWiFiAdapter().Wait();
  Console.WriteLine("WiFi adapter initialized.");

  // Temporary limitation, fixed later?  I hope?
  ConnectionStatus connStatus = Device.WiFiAdapter.Connect("ibl", "**********").ConnectionStatus;
  if (connStatus != ConnectionStatus.Success)
  {
    Console.WriteLine($"Could not connect to ibl (connStatus = {connStatus}).  Skipping scan.");
  }
  else
  {
    ScanForAccessPoints();
  } 

  Initialize();
  CycleColors(1000);
}

And I get this error message:

Could not connect to ibl (connStatus = UnspecifiedFailure).  Skipping scan.

I even tested it with an external antenna, and I still get the error.

Hey, sorry for the delay, @wlathbury and @nychold, sorry for the delay. We’ve released Beta 4.0.1 and an updated Visual Studio Extension. Please try upgrading your extension and flashing b4.0.1 to your Meadow. Let me know if you still have issues.

Just downloaded visual studio changes and Meadow.OS, and flashed my device.

When I tried to deploy my app, I got the following

Could not load file or assembly ‘Mono.Cecil, Version=0.11.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e’ or one of its dependencies

How do I go about updating my version of Mono?

thanks for all of your work on this project. I’m sure that it seems thankless from time to time.

follow up, downloading the Meadow.OS looks like this

[10/27/2020 12:25:35 PM] Downloading firmware version: 0.4.0.
[10/27/2020 12:25:37 PM] Download complete.

I don’t know if this is the latest, or if I should be seeing 0.4.1

Ditto on the Mono.Cecil error and firmware version 0.4.0. Additionally, the check I check the version number on the device, it says the release date was Sep 19, 2020 14:37:21

So I don’t think the extension is actually downloading the right Meadow OS version.

I uninstalled the Meadow VS extensions and reinstalled them, thinking maybe that might help the issue. I downloaded the newest version of the OS (which still says 0.4.0), but when I try to flash it, I get this:

[10/27/2020 9:39:58 PM] Begin ‘Flash Device’
[10/27/2020 9:39:58 PM] Upload Meadow.OS.bin (~2 mins)
[10/27/2020 9:41:07 PM] Initialize device (~30s)
[10/27/2020 9:41:33 PM] Trace logs no longer sent to CLI
[10/27/2020 9:41:34 PM] Mono disabled. Restarting Meadow
[10/27/2020 9:41:35 PM] MONO won’t start, it’s not enabled
[10/27/2020 9:41:35 PM] Mono disabled, will not run app.exe
[10/27/2020 9:41:45 PM] Meadow file download of ‘Meadow.OS.Runtime.bin’ has begun
[10/27/2020 9:41:48 PM] File 10% downloaded
[10/27/2020 9:41:51 PM] File 20% downloaded
[10/27/2020 9:41:54 PM] File 30% downloaded
[10/27/2020 9:43:40 PM] File 40% downloaded
[10/27/2020 9:46:49 PM] File 50% downloaded
[10/27/2020 9:49:58 PM] File 60% downloaded
[10/27/2020 9:53:07 PM] File 70% downloaded
[10/27/2020 9:56:16 PM] File 80% downloaded
[10/27/2020 9:59:25 PM] File 90% downloaded
[10/27/2020 10:02:34 PM] Download success (checksums calc:0x2E3049D9, expected:0x2E3049D9)
[10/27/2020 10:05:54 PM] An unexpected error occurred. Please try again.

This was my second attempt. Nearly 30 minutes, and an error.

Hi @nychold,

Too bad this is happening on your board. Out of curiosity, have you tried flashing the board via CLI? I have flashed about 5 boards and I haven’t got this issue (yet). I’ll try again, see if I can repro so we can investigate.