Step 1: Amarino

Here's my amarino code if you wanted to take a look. Don't laugh, please just give me some constructive criticism. 
I'm using a rooted HTC inspire. 
go to http://www.amarino-toolkit.net/index.php/download.html for more info.

I was experimenting with the switch case to try and get faster response times. do what ever you want. there used to be an if statement there.

I actually modified somebody's code off the internet, so some things seem arbitrary. (I hope I didn't use that word wrong..)
Your going to have to download the Amarino library for the Arduino IDE off their website. 

#include <MeetAndroid.h>
#include <Servo.h>

MeetAndroid meetAndroid;
Servo myservo;       //controls the steering
Servo motor;            //controls the for/rev motor

void setup()
Serial.begin(9600);     //default baud rate for bt module
meetAndroid.registerFunction(phoneorient, 'A');   //use event A in amarino
myservo.attach(9); //servo
motor.attach(8); //forward/backwards motor

void loop()
meetAndroid.receive(); // you need to keep this in your loop() to receive events

void phoneorient(byte flag, byte numOfValues)
//Phone Orientation Controller
int values[]={0,0,0};

// You must hold phone in LANDSCAPE for following orientation.
double x=values[1];     //store x as a double (long decimal number)
int y=values[2];
int z=values[3];
x = (-x);           //my steering was reversed, quick fix
if (x>2)
myservo.write(105 + (x-2)*2.5);  //values determined by trial and error for my car
else if (x< -2)
myservo.write(105 + (x+2)*3.571);  //unique for my car

myservo.write(105);        //unique center steering position
/* if (y>=7)
motor.write(90 + 25*(y-7));
} */

switch (y)       //tried to use a switch statement so that the motor was faster, reverse is a little glitchy I recommend using the if statement                           //anyways. If you do use the if, change y to a float/double instead of int. 
case 9:
case 8:
case 7:
case 6:
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
case -1:
case -2:
case -3:
case -4:
case -5:
case -6:
case -7:
case -8:
case -9:
/*else if (y<1)
motor.write(90 - (y-1)*);
honestly, using adk is like violation of diy moral code plus no fun at all and expensive. its like u have attiny 13 and its components but u use arduino uno board instead, uzzors must hate it too. <br> <br>btw, can u list the components of yours and where to get them man? its confusing. where to buy the h bridge and 4 mhz crystal and everything
K, I will draw a schematic this weekend and upload it. What are you trying to build?
I intend to build this uzzors car, man, its just confusing to get the parts. Like what is h bridge and where to get it and whats 4 mhz thing in uzzors schematic of this bluecar. And what kind of bluetooth module we should get, this thing is not for newbies this is for intermediates eventhough u made the code digestable by the newbies but the components are no way for the newbies so its only inters who can get this project. <br>Please list ur components name and how to get them, man, u have made the code to be &quot;newbie&quot;-enabled but the components are still not newbie reachable.
Hi friends.... recently I started to work on a project in which I have to use the accelerometer data of android and send it via bluetooth to my computer into a data sheet..... where a program uses the data to control my robot<br>I have installed the java prog version of android<br>can you guys tell me how to access the accelerometer in JAVA and bluetooth module to send data??<br>thanks a lot
Hey thanks for sharing that - good to see other people working on Android-Arduino interfaces. I highly recommend looking into the ADK. Good luck with your future projects!
I totally would, if the adk was cheaper... IOIO seems pretty cool. It's just so un DIY if you paying 100+ for a protoboard that doesn't do Bluetooth. But I guess is the real benefit is the Android app...
You have a good point, and also (I think more of a deal-breaker for some) is that you need to have the right Android version - either stock 2.3.4 or 3.1 or later. That cuts out huge numbers of would-be Android hardware hackers. Having said that, they make it pretty easy for anyone to get into it, and they are committed to support it in the OS for all future releases which is always a good thing. It literally becomes a plug-and-play technology - you can even tell the OS to go to the market and download your app when the hardware is plugged in, if you don't have it installed already. Anyway, not to dissuade you from your current projects, well done and keep it up!
Well played sir, I'm voting for your project.

About This Instructable


9 favorites


Bio: I like cheezy music and cheezy movies.
More by robwasab: Reverse Engineering =Uzzors2k= Bluecar Android App. Amarino Stuff Too.
Add instructable to: