Android open accessory

From LVL1
Revision as of 02:16, 2 June 2011 by Joepugh (talk | contribs) (Started list of changes to get the Arduino sketch compiled)
Jump to navigation Jump to search

This stub is to document the process of trying to get AOA working with older hardware. ie freeduino + spark fun host shield and phones not currently supported.


What I am using

Hardware

  • Freeduino 1.22 with a ATmega328p-pu chip
  • Sparkfun USB Host shield
  • HTC G2

Software


* indicate that I had to change the code to get it to work.

Changes

There are a few changes that have to be made to the stoke software to get this to work.

demokit.pde

Out of the box the Arduino sketch for the demokit will not compile for the ATmega328. There are a lot of pins that are used that do not have the same name or do not exist.

#include <Wire.h>
#include <Servo.h>
#include <Max3421e.h> #include <Usb.h> #include <AndroidAccessory.h>
#include <CapSense.h>
#define LED3_RED 2 #define LED3_GREEN 4 #define LED3_BLUE 3
#define LED2_RED 5 #define LED2_GREEN 7 #define LED2_BLUE 6
#define LED1_RED 8 #define LED1_GREEN 10 #define LED1_BLUE 9
#define SERVO1 11 #define SERVO2 12 #define SERVO3 13
#define TOUCH_RECV 14 #define TOUCH_SEND 15
#define RELAY1 A0 #define RELAY2 A1
#define LIGHT_SENSOR A2 #define TEMP_SENSOR A3
#define BUTTON1 A6 #define BUTTON2 A7 #define BUTTON3 A8
#define JOY_SWITCH A9 // pulls line down when pressed #define JOY_nINT A10 // active low interrupt input #define JOY_nRESET A11 // active low reset output

After removing the definitions that are not used. removed all of the functions that control things that will not be used and changed everything to LED/buttons you this is whats left.