Okay, so whilst the Formula 1 Grand Prix was on the TV, I decided to multi-task and get Arduino & Pandora working together...
My initial findings were that it would not be efficient to try and get the Arduino IDE to run on the Pandora. I googled quite a bit and found that many people have used different front-ends to compile, build and deploy to the Arduino. I decided to strip back to basics for the Pandora and have documented the steps below.
Requirements:
Open Pandora 256Mb 800Mhz Super Zaxxon Final release
avrtools installed (as linked to in earlier post)
Arduino Atmel328p device
USB 1.1 Hub (could not get Open Pandora to detect Arduino directly plugged in, assumed this was due to it using USB 2.0?)
Arduino 1.0.1 IDE (only if want to compile own library file - see next link [and for getting the .h files])
copy /hardware/arduino/cores/arduino/*.* to Open Pandora /mnt/utmp/avrtools/include
copy /hardware/arduino/variants/standard/pins_arduino.h to Open Pandora /mnt/utmp/avrtools/include
libarduino.a (obtained from
http://lastyearswish...aa5d80d3d1c6920 )
copy libarduino.a to Open Pandora /mnt/utmp/avrtools/lib
creation of makefile and copy to Open Pandora /mnt/utmp/avrtools (make sure that the commands have TAB and not spaces, otherwise you get errors)
creation of flash_led.c in /home/tony
Steps:
Plug Arduino into USB 1.1 Hub
Plug USB hub into Open Pandora
Open Pandora, Enable USB Host
navigate to /dev/
check for existence of ttyUSB0
This will indicate that the Arduino is accessible (occasionally I had to restart Open Pandora for it to pickup the USB 1.1 Hub)
From menu select, development | avrtools
This starts in Terminal mode
I found that I had to be root user to be able to have permissions to dowload to the Arduino
sudo -s
<password>
make all FILE=flash_led
(this will compile the .c file, output it to .elf, then convert .hex and download to the Arduino using avrdude. The makefile is reading and outputting to /home/tony - you'll have to change this to suit your setup)
flash_led.c
Code:
#include "/mnt/utmp/avrtools/include/arduino.h"
int led = 13;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
makefile
Code:
default:
avr-gcc -B /mnt/utmp/avrtools/lib -Os -mmcu=atmega328p -o /home/tony/${FILE}.elf /home/tony/${FILE}.c -larduino
avr-objcopy -O ihex -R .eeprom /home/tony/${FILE}.elf /home/tony/${FILE}.hex
upload:
avrdude -c arduino -p m328p -b 57600 -P /dev/ttyUSB0 -U flash:w:/home/tony/${FILE}.hex
all: default upload
http://www.youtube.com/watch?v=fsHAW_CN5M0. I'm very happy that I am now able to use 'mousepad' on my Pandora to write my Arduino code and then run 'make' as detailed above and have the code running on the Arduino!
EDIT:
https://www.youtube.com/embed/x2rZAopQwDo?feature=oembed showing the flashing of a real light :rolleyes: