jc-cr / ArduinoCLIControl

Simple how to and example guide for how to program and communicate with an Arduino dev board from Ubuntu CLI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArduinoCLIControl

This goal of this repo is to provide an example of how you would program and communicate with an Arduino dev board from an Ubunutu CLI instead of using the Arduino IDE.

For this example I made a library for communicating with arduino nano, specifically for communicating with the ATmega328P microprocessor with UART, and then toggling the on board LED via minicom package.

How To

  1. Install required packages:
sudo apt install minicom gcc-avr avr-libc avrdude
  1. (Optional) Create udev rules so you can always find your device when connected.
  2. Make a new project folder. If you want to try out this repo you could just do:
git clone https://github.com/jc-cr/ArduinoCLIControl.git
  1. Pump out some code for your microcontroller.

    • In my repo I created a main.cc in which I included my library for UART comm and LED toggling, ledController.h.
  2. Create a Makefile.

    • Check out my for an example, but also check this out for how to make your own:
    • AVR Makefile Example
  3. Compile and upload (Assuming your device is connected):

make 
make upload
  1. Connect and communicate. With minicom you can do:
    • Make sure to update with your device symlink name or USB port (found with lsusb)
minicom -D /dev/yourDevice -b 9600

You can exit minicom by doing the following keystrokes:

Ctrl + A
X
Enter

About

Simple how to and example guide for how to program and communicate with an Arduino dev board from Ubuntu CLI

License:GNU General Public License v3.0


Languages

Language:C++ 80.7%Language:Makefile 19.3%