Arduino Edit, Compile, Upload, Read Serial by LInux Pocket Chip
by masteruan in Circuits > Arduino
1763 Views, 22 Favorites, 0 Comments
Arduino Edit, Compile, Upload, Read Serial by LInux Pocket Chip
Do you want write, compile and upload your Arduino everywhere?
Do you are ready to read this tutorial?
If the answers are YES - YES - YES - YES... you can read below. CHIP is a single board computer. Pocket CHIP is a device with CHIP and touch screen, keyboard and battery. The operative system of CHIP is Linux. You can download all the package, and start to program Arduino.
Install the Software
Open the Terminal App on Pocket CHIP, and type:
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install python-serial arduino arduino-mk
The Working Directory
Create directory by typing this command in Terminal window:
mkdir ~/sketchbook
This is the directory where you can edit and create new Arduino projects.
Setup the Files
Now you can copy the Blink code to sketchbook directory:
cd ~/sketchbook
cp -a /usr/share/doc/arduino-mk/examples/Blink .
Open the directory:
cd Blink
Show the content of directory:
ls -l
You will see this:
-rw-r--r-- 1 chip chip 509 Jul 12 2014 Blink.ino
-rw-r--r-- 1 chip chip 61 Jul 12 2014 Makefile
Open the Makefile and edit
Type:
sudo nano Makefile
Write in the file
BOARD_TAG = uno
ARDUINO_LIBS =
include /usr/share/arduino/Arduino.mk
Compile the Program
In the terminal windows now you can compile the program by typing
make
If you want compile and upload the code into your Arduino type:
make upload
Do you want read other about this prog:
All the Board That You Can Compile
The alternatives
uno: Arduino Uno
atmega328: Arduino Duemilanove w/ ATmega328
diecimila: Arduino Diecimila or Duemilanove w/ ATmega168
nano328: Arduino Nano w/ ATmega328
nano: Arduino Nano w/ ATmega168
mega2560: Arduino Mega 2560 or Mega ADK
mega: Arduino Mega (ATmega1280)
leonardo: Arduino Leonardo
esplora: Arduino Esplora
micro: Arduino Micro
mini328: Arduino Mini w/ ATmega328
mini: Arduino Mini w/ ATmega168
ethernet: Arduino Ethernet
fio: Arduino Fio
bt328: Arduino BT w/ATmega328
bt: Arduino BT w/ATmega168
LilyPadUSB: LilyPad Arduino USB
lilypad328: LilyPad Arduino w/ ATmega328
lilypad: LilyPad Arduino w/ ATmega168
pro5v328: Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328
pro5v: Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega168
pro328: Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
pro: Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168
atmega168: Arduino NG or older w/ ATmega168
atmega8: Arduino NG or older w/ ATmega8
robotControl: Arduino Robot Control
robotMotor: Arduino Robot Motor
You can also use custom board profiles, but that’s beyond the scope of this post! Most common Arduino compatible boards match something on this list. For example, the Freetronics EtherMega operates just like an Arduino Mega with a 2560 processor, so you’d select “mega2560” as the BOARD_TAG in the Make file.
Do You Want Read the Serial Message by Arduino
If you want read the serial message, you can install screen
Screen is a simple program that show the serial message. For installation on the Terminal type:
sudo apt-get update
sudo apt-get install screen
For use Screen you must have the name of Arduino serial port, and the baud-rate. The default baudrate for Arduino UNO is 9600, for the name of serial port, you can connect Arduino, and type:
dmesg|tail
and see something like this /dev/ttyACM0 this is your serial port
Now you can read the serial messages by using:
sudo screen /dev/device baud-rate