![]() Follow this link to read more about the Serial class. The reference documentation on the mbed website provides insight for the tools it provides and includes several examples. It slows down the while loop by making it pause for 1 second to prevent spamming the terminal with the “hello world” message. The wait() function is another useful function provided by mbed.The Serial class provides a number of useful functions, and we’re using the printf () function to write to our terminal every second.Line 3 defines an object of the Serial class with the pins we wired up previously (PA9 for TX, PA10 for RX).And don’t forget to wire your ground pin as well!Ĭopy and paste the example below into main.cpp: RX on the board corresponds to TX on the dongle. ![]() TX on the board corresponds to RX on the USB-to-serial dongle. Remember that for UART, TX goes into RX and RX goes into TX. See the image below to get an idea of the hardware wiring. We’ll use the same pins this time around as last time, taking advantage of PA9 and PA10 for our UART RX and TX. Mbed also provides pictures of pins and their respective functions on their website for each of the boards they support. Since we’re not using CubeMX to generate our project this time around, we need to look up the datasheet for our board to see which pins have which functionality. In the previous Nucleo UART tutorial, CubeMX had a nice graphical interface to configure our pins. If all goes well, you should see something like the following:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |