Closed CrazyRobMiles closed 5 years ago
@CrazyRobMiles no idea about the Air Quality sensor, could you give more details?
Hi @CrazyRobMiles , you can use SDK in boards manager. Code in this repo is the same as the one in boards manager.
Here's an example for DevKit to use Serial1
. In this example, two DevKits talk to each other with Serial1.
https://github.com/VSChina/devkit_music_player/blob/master/MusicPlayer/MusicPlayer.ino#L176 https://github.com/VSChina/devkit_music_player/blob/master/VoiceRecorder/VoiceRecorder.ino#L227
Hi. Thanks for getting back to me. I tried Serial1 originally, but the compilation fails with:
error: 'Serial1' was not declared in this scope
When I'm editing the code the Intellisense for Serial1 works fine, it's just at the build that it fails. I've built and deployed other programs. I'm using the DPS sample as my starting point and that compiles and deploys fine.
I've had a look in the SDK and the code looks to be the same as is on the GitHub repository for this release:
https://github.com/Microsoft/devkit-sdk/commit/d7e1642e122e7e2709e2b2c31e7f597b61f8a047
I can't find a declaration of Serial1 anywhere in the code. UARTClass has mention of UART1 but that seems to be as far as it goes.
Ha! Fixed it. The Serial1 device was not declared in Variant.cpp or Variant.h Not sure why, but adding them to the files seems to have made the second serial port work for me as Serial1
It's a simple fix, I've forked the repository and made the change [here:] (https://github.com/CrazyRobMiles/devkit-sdk)
@CrazyRobMiles we don't want have another Serial instance, because most of time people don't need it and have it pre-created will waste the limited resource, that why it's not in the Variant.cpp. So create a new one if want to use Serial1, otherwise give the resources back.
OK. That's fair enough. But the example programs that you pointed me at seem to assume that Serial1 does exist and won't compile with the current release of the platform. I suggest that you add the statement
UARTClass Serial1(UART_1);
to these programs so that they will build.
You might also like to add some coverage of this to the FAQs for the device. I've created an example application and blogged it here:
http://www.robmiles.com/journal/2018/12/4/using-serial1-with-the-azure-iot-devkit
I'd like to be able to use Serial1 to connect an Air Quality sensor, but it doesn't seem to work. I'm using the SDK as obtained via the boards manager. Do I have to use this one instead?