Arduino hello world
06 Nov 2015
Using an Arduino board with a GNU/Linux personal computer has become pretty straightforward. The following command will install the required software:
In order to get the file-system permissions to use the USB-serial it is necessary to add the current user to the dialout group. It is necessary to log out and back in after this.
For the Arduino Diecimila you then create a Makefile with the following content (see /usr/share/arduino/hardware/arduino/boards.txt for other supported boards).
Make sure that /dev/ttyUSB0 is the right device! You can do this by inspecting the output of dmesg after plugging in the Arduino device.
Now you can create a sketch file (ino file extension) for programming the micro controller. E.g. a file Blink.ino with the following content:
Finally compile and upload the code:
The source is available on Github: github.com/wedesoft/arduino-hello-world
Update:
It is also possible to switch the LED according to instructions send over the USB serial channel. The following program facilitates this:
After opening screen as a serial terminal, the LED can be controlled using keys ‘1’ and ‘0’:
Exit with Ctrl-A \
See also: