Introduction: Programming an Arduino From Raspberry Pi
Learn how to install the Arduino IDE on your Raspberry Pi so that you can write and upload programs onto an Arduino.
1x Raspberry Pi
Plus what ever cables are needed such as USB to Arduino.
Step 1: Install/config
Assuming you have a Raspberry Pi setup(if not chick here or look at Video above ), we start from the Terminal prompt:
- sudo apt-get update
- sudo apt-get dist-upgrade
- sudo apt-get install arduino
Adding USB/Arduino support you need a configuration script from Gethub
- wget https://github.com/wyolum/alamode/blob/master/bun... -O alamode-setup.tar.gz
- tar -xzf alamode-setup.tar.gz
- cd alamode-setup
- chmod 777 setup
- sudo ./setup
Add serial support for python.
- wget http://pypi.python.org/packages/source/p/pyserial... -O pyserial-2.7.tar.gz
- tar -xzf pyserial-2.7.tar.gz
- cd pyserial-2.7
- sudo python setup.py install
check if USBserial is working.
- ls -ltr /dev|grep -i ttyUSB
Step 2: Upload a Program to the Arduino
Now since we have the raspberry pi setup lets go to the a GUI
Click on the start bar and look for the category "Electronics" and find the new Arduino IDE.
You should find a blank sketch with no code. You need to determine what kind of Arduino you have and what port you are using. (note: Some knock off Arduino don't come with a firmware try this link on how to Burn Bootloader)
Go to File > Example > 01 Basics > Blink
You should see some code in Arduino IDE. Play around with the code. The blink sketch turns on an LED on for one second, then off for one second, repeatedly.
Check upload, if the light blinks then it worked!!