I’m new to the Meadow and want to create some small programs for testing purposes. For this, it would be helpful that I can communicate from a program running on my PC with the program running on the Meadow.
As far as I understand, the USB cable, which is used for uploading the program to the meadow, is used as a serial emulation via COM5 (at least at my PC), and there is some kind of Meadow CLI, which can do e.g. firmware updates, but also the transfer of the program.
My questions are:
is this serial communication over the USB cable always active, or can I use that for communication with my meadow program, when the upload is done or not active?
Do I have to use the Resolver class for this?
in the case that I can’t use this cable, I could establish a serial communication using a seperate USB/COM-Adapter with one of the UARTs on the meadow. Is this the way to go? Or is there an easier way?
I know that I could use Bluetooth or WLAN, but that’s not on my list for my first test programs.
Are there any sample programs I could use for this (of course I searched for this, but unfortunately didn’t find one)?
USB as it stands at the moment can be used to send data to the USB port on you computer. It is Meadow to the computer only. Currently there is no option to send data / text from the computer to Meadow via this mechanism.
You do not have to user the Resolver class to do this, you can send text either via the Resolver class or Console.Write statements. Output can be picked up using the Meadow CLI tool with the command:
If you don’t want to use the CLI tool then you can attach any serial communication program to the COM port and you will see the same output but it will be prepended by about 12 bytes of binary data.
There are two serial ports on the board, COM1 and COM4 and you can use these as bidirectional serial ports. Your application would have to deal with the serial processing using the serial port classes built into Meadow.Core. You can find this documented on the Developer Portal.
I had a similar question. It would be really nice if there was a simple option to switch the USB port to be a USB CDC device, as on the very cheap ESP32-S2 modules (which I use a lot). Otherwise, you can use a cheap USB-to-serial module like the FT232L on one of the serial ports.
The Resolver is a simple, low-overhead Dependency Injection (DI) container. By default, Meadow.Core adds a few objects to it, such as the ILogger instance, the Device instance and the IApp instance, but you can use it to store any other singleton your application might want to use.