Serial1 usage

If you made your own board, post here, unless you built a Maple or Maple mini clone etc
Post Reply
RolfSte
Posts: 1
Joined: Mon Oct 04, 2021 7:03 pm

Serial1 usage

Post by RolfSte »

Hi,

I'm using an NUCLEO F103 board and try to send monitor data over Serial1.

This works in setup:

Code: Select all

void setup() {
	HardwareSerial Serial1(PA10, PA9);
	Serial1.begin(9600);
        Serial1.println("Testpoint 1");
       ......
but I have found no way to use Serial1 in other functions
or globally for classes in other files.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Serial1 usage

Post by fpiSTM »

You have to define the Serial1 outside the setup function to be global else it is local at the function.

Code: Select all

HardwareSerial Serial1(PA10, PA9);

void setup() {
        Serial1.begin(9600);
        Serial1.println("Testpoint 1");
}
Post Reply

Return to “Custom design boards”