Connect your CircuitPython board to your computer with a known good data USB cable. Next, you'll connect to the board using the CircuitPython extension.
You'll see the contents of your CIRCUITPY drive appear in VS Code. The CircuitPython extension activates when any of these files are opened in VS Code:
- code.py
- code.txt
- main.py
- main.txt
- boot_out.txt
By opening your CIRCUITPY drive, the extension is now activated.
Ā
Ā
At the bottom of the VS Code window, you'll see text that says <Choose a board> and a littleĀ plug icon. Select the plug icon.
In the search bar at the top of VS Code, you'll see Select a serial port appear in the bar. In the dropdown, you should see your CIRCUITPY drive board name and its COM port. Click on the board.
This connects to the Serial Port on your board. At the bottom of the VS Code window, you'll see your board name appear. If you select the Circuit Python Serial Monitor in the terminal tab, you'll see that the board COM port is opened and you can access the REPL by entering CTRL+C.
Using the Serial Monitor and REPL
PressĀ CTRL+C, you should see a soft reboot occur and your code.py file should run.
In the serial monitor above, this simple code.py file is running where the value of i
increases by 1
every second and prints to the serial monitor.
You can also enter the REPL by entering CTRL+C. Test this out by entering print("hello world")
. You should see hello world
print back.
Accessing Special Commands
The CircuitPython extension has special commands available for accessing the serial monitor and library management with circup, a command line tool to manage and update libraries on a CircuitPython device. You can even access a quick link to your board on circuitpython.org.
In the search bar at the top of VS Code, click in the bar. A dropdown menu will appear. Select Show and Run Commands.
Text editor powered by tinymce.