Arm Mbed OS support forum

Looking for example UART code for Numaker M263A

Hello, I’m new to this forum. I am trying to create a UART between an Arduino Uno and a Numaker M263A. I think i have the UNO side of things set programmatically, but I need help with the mbed side. Are there any code examples out there?

Can anyone help point me to the right path please?

I’m playing around with this code in the Numaker to start:

// 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);
    
}

}

Thank you!

Hello,

usually is good to share also info about MbedOS version what you use. And for correct code formatting in your post, please be so kind and use these three symbols ``` before and after your code.

Pins D0 and D1 are usually used for debugging via STDIO.

Because you use Serial object you probably use old MbedOS version - Serial - APIs | Mbed OS 5 Documentation.

BR, Jan