Using serialUSB on the b-l072z-lrwan1 board

I'm new to Arduino (it's cool!), and I'm having trouble using the native USB port on the CMWX1ZZABZ-091 chip.

In my program the line:

SerialUSB.begin()

..just generates the error "'SerialUSB' was not declared in this scope.'

I understand what that means, but how do I fix it? I'm using all the default files outlined in the tutorials.

I've been searching for an answer for hours now, not making any progress. Can someone help me out?

What’s your « arduino » board ?and have you installed it/ selected it as the target? (It’s probably close to an Arduino SAMD Core but requires likely its own stuff)

Also if you were to point at the tutorial you are following, that would probably help others help you... provide as much info as needed... (full code and not snippets, clickable links to your board, description of what you installed and configuration, version of the IDE, drawing of your wiring etc)

Thanks for your response J-M-L,

The board I'm using is the "https://www.st.com/en/evaluation-tools/b-l072z-lrwan1.html" from ST Micro
I'm using the Arduino core from: GitHub - GrumpyOldPizza/ArduinoCore-stm32l0: Arduino Core for STM32L0, and I followed the directions given on that site

Inside the Arduino IDE, I can see the board, and download sketches to it.

The problem I'm having is when I try to use the native USB port on the MCU. Thats when I get the error I mentioned in the OP.

Thanks!

Although some of the other boards in the ArduinoCore-stm32l0 package do have a SerialUSB object, the b-l072z-lrwan1 board does not. I suspect this is because it uses a separate virtual COM port adapter chip instead of the native CDC capabilities of the STM32L0.

So the answer is that you can't use SerialUSB. If you want to communicate with the computer via the USB cable, the object to use is Serial.

It looks like there's an on-board ST-Link programmer between the STM32L0 and the computer, which is generating the virtual COM port, thus the use of the Serial object instead of the SerialUSB object.