Looking for example UART code for Nuvoton Numaker M263A

Hello, I have been using the web compiler 1.10.25.0 to burn example projects to a Numaker M263A https://direct.nuvoton.com/en/numaker-iot-m263a

I want to create a UART between an Ardiuno Uno and this board. Can someone please help get me started with the code?

I have been playing around with something like this for the Nuvoton board, but someone suggested it may be old:


// Create a DigitalOutput object to toggle an LED whenever data is received.
static DigitalOut led(LED1);

// Create a BufferedSerial object with a default baud rate.
static Serial serial_port(D0, D1);

int main(void)
{


if (serial_port.readable())//compilation error here {
    char data_rec = serial_port.read();// and here
    
    if (data_rec == '1') digitalWrite(led, HIGH);
    if (data_rec == '0') digitalWrite(led, LOW);
    
}


}

I want to use the Ardiuno Uno compatible extension connector.

Any help is greatly appreciated!

Eric

Hello,

I don’t understand why you start another topic for same thing instead of asking more specific questions.

I see nothing wrong except your comment what broke the syntax of braces {

Replace it with serial_port.getc();

Change to led = 1; and led = 0;

BR, Jan