Difference between revisions of "Android open accessory"
Jump to navigation
Jump to search
(→Software: Added links to everything.) |
(Started list of changes to get the Arduino sketch compiled) |
||
Line 23: | Line 23: | ||
<br> | <br> | ||
* indicate that I had to change the code to get it to work. | * 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> | ||
+ | <s>#include <Servo.h></s><br> | ||
+ | #include <Max3421e.h> | ||
+ | #include <Usb.h> | ||
+ | #include <AndroidAccessory.h><br> | ||
+ | <s>#include <CapSense.h></s><br> | ||
+ | #define LED3_RED 2 | ||
+ | #define LED3_GREEN 4 | ||
+ | #define LED3_BLUE 3<br> | ||
+ | #define LED2_RED 5 | ||
+ | <s>#define LED2_GREEN 7 | ||
+ | #define LED2_BLUE 6<br> | ||
+ | #define LED1_RED 8 | ||
+ | #define LED1_GREEN 10 | ||
+ | #define LED1_BLUE 9<br> | ||
+ | #define SERVO1 11 | ||
+ | #define SERVO2 12 | ||
+ | #define SERVO3 13<br> | ||
+ | #define TOUCH_RECV 14 | ||
+ | #define TOUCH_SEND 15<br></s> | ||
+ | #define RELAY1 A0 | ||
+ | #define RELAY2 A1<br> | ||
+ | #define LIGHT_SENSOR A2 | ||
+ | #define TEMP_SENSOR A3<br> | ||
+ | <s>#define BUTTON1 A6 | ||
+ | #define BUTTON2 A7 | ||
+ | #define BUTTON3 A8<br> | ||
+ | #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</s> | ||
+ | |||
+ | 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. |
Revision as of 02:16, 2 June 2011
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
- Arduino 0022
- ADK release 0512
- AndroidAccessory (library for Arduino)
USB_Host_Shield (library for Arduino)- demokit.pde (Arduino sketch for the demokit)*
- Romfont USB_Host_Shield (library for Arduino)*
- ADK release 0512
- Rancidbacon.com demo sketch & app
- Eclipse
- Android SDK
- DemoKit (demo android app that comes with the ADK)
- Android SDK
- CyanogenMod-7-05252011-NIGHTLY-vision (based on 2.3.4)
* 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 RELAY1 A0 #define RELAY2 A1
#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 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.