# Code example to use the RPi pico UART

**URL:** <https://forum.embeetle.com/t/code-example-to-use-the-rpi-pico-uart/871>\
**Category:** Uncategorized\
**Created:** [January 29, 2024, 4:53pm UTC](https://forum.embeetle.com/t/code-example-to-use-the-rpi-pico-uart/871 "2024-01-29T16:53:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cleidir](https://forum.embeetle.com/user_avatar/forum.embeetle.com/cleidir/32/1137_2.png) [@Cleidir](https://forum.embeetle.com/u/Cleidir)\
**Post date:** [January 29, 2024, 4:53pm UTC](https://forum.embeetle.com/t/code-example-to-use-the-rpi-pico-uart/871/1 "2024-01-29T16:53:06Z")

</div>

Hi guys,

I share with you a modification of the blinky example for the RPi pico.

In this modification I use the RPi pico w, I modified the blinky pin of the LED and I call the **debug\_uart.c** and **debug\_uart.h** libraries.

The **debug\_uart\_initialize()** function will configure the UART to the standard 8 data bits, with a parity bit (null) and a stop bit ( **8N1** ) with a baudrate of **115200**.

the **debug\_uart\_send\_String(“”)** function is responsible for sending an unformatted string.

```C
void main(void) {
    RESETS->RESET = RESETS->RESET & ~0x00000020lu; // take IO_BANK0 out of Reset
    PSM->FRCE_ON = PSM->FRCE_ON | 0x00000400; // make sure that SIO is powered on
    SIO->GPIO_OE_CLR = 1ul << 22;
    SIO->GPIO_OUT_CLR = 1ul << 22;
    PADS_BANK0->GPIO25 = 0x00000030;
    IO_BANK0->GPIO25_CTRL = 5;
    SIO->GPIO_OE_SET = 1ul << 22;
    init_time();

    debug_uart_initialize();
  
    for ( ; ; ) {
        // uint8_t data = 23;
        SIO->GPIO_OUT_SET = 1 << 22;
        // Delay
        delay_us((10 / 1 * 60) * 1000);
        SIO->GPIO_OUT_CLR = 1 << 22;
        // Delay
        delay_us((10 / 1 * (100 - 60)) * 1000);
        debug_uart_send_String("Send string without formatting\n");
    }
}

```

I’m working on the option to format the string, but still without success, there is a library in the LIB folder of the example project with a printf() prototype but I’m having difficulty correctly calling the functions declared there.

---

<div class="post-metadata">

**Author:** ![matkuki](https://forum.embeetle.com/user_avatar/forum.embeetle.com/matkuki/32/52_2.png) [@matkuki](https://forum.embeetle.com/u/matkuki)\
**Post date:** [January 31, 2024, 8:44am UTC](https://forum.embeetle.com/t/code-example-to-use-the-rpi-pico-uart/871/2 "2024-01-31T08:44:07Z")

</div>

Very good @Cleidir ,

If you complete this `debug_print` functionality, we would be happy to add it to the default library code for the RPi Pico W, if you agree to allow it.

Keep up the good work 👍

Matic
