Setting up a serial monitor in VSCode for Zephyr development.

Jul, 26 2021

Let us make sure we can read out our print statements so we know what's going on with our device. For this we'll install the Arduino VSCode plug in, we'll be using the serial monitor feature of the extension.

Choose the extensions icon from the left navigator panel and search for Arduino. You know the drill, download & install it.

arduino extension

Then navigate to the src/main.c file in your blinky directory. In the while(1) loop, add a print statement.

while (1) { gpio_pin_set(dev, PIN, (int)led_is_on); led_is_on = !led_is_on; k_msleep(SLEEP_TIME_MS); printk("here!\n"); }

In VSCode go to view ➡️ Command Palette and then search for Arduino: Open Serial Monitor. It will have you choose a port. Choose the device labeled SEGGER.

serial port selection

In the bottom right, there should be a little plug icon. Click it and you should see an output window appear with the text: "Opened the serial port".

plug icon