Develop Arduino with vscode @Ubuntu

The environment is Ubuntu 20.

Download and install Arduino in/opt /.

wget https://downloads.arduino.cc/arduino-1.8.13-linux64.tar.xz ;
tar xvf arduino-1.8.13-linux64.tar.xz ;
sudo mv arduino-1.8.13-linux64 /opt/ ;
cd opt arduino-1.8.13-linux64/ ;
sudo ./install ;

vscode installation

Download from the official website

https://code.visualstudio.com/download

Since it is Ubuntu, select deb to download the file and install it.

sudo apt install ~/Downloads/code_* ;

launch vscode

code ;

Make vscode recognize Arduino.

First, install the extension Arduino (made by Microsoft)

ctrl + shift + x

Or

File -> Preferences -> Extensions

Select Arduino (made by Microsoft)

Next, set the path of the installed Arduino in/opt /. Open the settings screen

ctrl + ,

Or

File -> Preferences -> Settings
item Set value
Arduino: Command Path arduino
Arduino: Path /opt/arduino-1.8.13

Open the sample program

ctrl + shift + p
↓
Arduino:Examples

Specify the board.

ctrl + shift + p
↓
Arduino:Board Config

Example)

item Set value
Selected Board Arduino Nano
Prosessor ATmega328P(Old Bootloader)

Upload sketch to board

ctrl + alt + u

Specify serial port Example) ttyUSB0

Allows the usb serial port to be written.

sudo chmod a+rw /dev/ttyUSB0 ;

However, since it is troublesome to type the command every time, I will write the rule in udev.

sudo gedit /lib/udev/rules.d/50-udev-default.rules;

# serial
KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout", MODE="0666"

Serial monitor display

ctrl + shift + p

Arduino:Open Serial Monitor

I often use it, so I think you can assign a shortcut by clicking the gear next to the text.

Specify the transfer speed for the USB type. Click the number 115200 at the bottom right of the window Example) 9600

Recommended Posts

Develop Arduino with vscode @Ubuntu
Introduced vscode with apt to docker: ubuntu
Install Gradle with ubuntu16.04
I wanted to develop PHP with vscode remote container
Develop C programs with guard
Update gitlab-runner with Ubuntu automatic update
Install Arduino IDE on Ubuntu 20.04
Build Ubuntu 18.04.5 with dual boot
Install java with Ubuntu 16.04 based Docker
Let's create Ubuntu environment with vmware
Build PlantUML environment with VSCode + Docker
ubuntu20.04 ・ Run RTAB-MAP with ROS Noetic (1)
Install ruby on Ubuntu 20.04 with rbenv
Ubuntu Server 20.04.1 Autoinstall with USB boot
Develop Processing with IntelliJ + Kotlin + Gradle