Arduino Programming From Text Editor & CLI


To program Arduino, we can use Arduino IDE which facilitates writing and uploading code to the board.

If we are using a text editor for programming, it will have lot of customisations which speed up development process. In such case, it is better to use same text editor for arduino programming too.

I use Emacs as IDE and there is arduino mode for emacs which provides syntax highlighting and some useful utilites to write arduino code. We can find such packages for other editors also.

Arduino also provides cli interface to upload code to arduino. To upload code, we need to specify port, board and the code to upload.

In Linux system, to upload a file called foo.ino, we can run

arduino --port /dev/ttyACM0 --board arduino:avr:mega
 \ --upload foo.ino

An alternate way is to use platformio, an opensource tool chain for IoT development.

It can be installed using pip.

pip install platformio

Once it is installed, code can be directly uploaded using ci command.

platformio ci --board=mega foo.ino

By this we can use text editor to write code and arduino/platformio to upload code to arduino board.



I am Chillar Anand. I daydream a lot and write about the things that interest me here. You can read more about this blog here.

See all articles

RSS Feed for the blog

Edit this page