Google earth and Arduino

Hi guys! thks for this great forum! it's very helpful! I came here to ask you to help me with school project. I have a hard time in this class! There is very little help for people who just started! all right, let me explain my project to you. I want to use arduino and processing to be able to create a hardware that would control google earth. I want my hardware to go up, down, right and left on the map, zoom in and out with two buttons.

I will be using a joystick from an old playstation: like u see here in this picture. I also use two buttons from my old logitech joystick. they are the back buttons: I used the back buttons, as seen on this picture.

could u tell me how i could add the buttons and make them work on processing ? please?

I wonder if there is a way to make my hardware work with google earth , if any of u knows how to please answer my post. :)

the code that used to make the jostick work on processing is the on of the etch a sketch. So I put a pic from google earth and slide up and down, left right. Still have no idea how to make buttons work.

I would need all the help you can give, this is a very important project, that i need to finish after by the 24th of march.

thks

Sonia I can t wait for your answers!

these are the pictures: joystick: http://www.soniamcangel.net/joy.jpg button: http://www.soniamcangel.net/btn.jpg

If you have a joystick connected to Arduino that is controlling a Processing sketch on your PC you have done a lot of the hard work. I suggest you break the remaining work into small tasks like:

Get buttons working locally on Arduino. Get Processing to respond to Buttons. Get Processing to control google earth (are you intending to do that by emulating mouse movement?)

There may be a few more things to do but when you have those pieces working you will be almost there.

If you have questions on any of these, the best way to get them answered is to post a code fragment of the part you need help on, and describe what you want it to do and what is not working in your code.

Have fun!

I wonder if there is a way to make my hardware work with google earth , if any of u knows how to please answer my post.

This might be more than what you want (also, it doesn't currently work with Arduino 0013 so you'd need to use Arduino 0012) but this would allow you to connect your joystick directly without using Processing (assuming Google Earth works with a standard joystick):

Arduino USB joystick

--Phil.

Hi Phil, he could also plug a joystick directly into the PC ;)

Your proposal removes so many of the interesting learning challenges that it may undermine the projects educational value.

Great suggestion though for people that just want to get up and running with google earth.

he could also plug a joystick directly into the PC

I don't think she could with this one: :P

Your proposal removes so many of the interesting learning challenges that it may undermine the projects educational value.

That's not like me to suggest something that would do that, is it... :-)

--Phil.

One could control Google Earth without the need of simulating mouse movement. http://code.google.com/intl/nb-NO/apis/earth/

One could control Google Earth without the need of simulating mouse movement. http://code.google.com/intl/nb-NO/apis/earth/

I wonder if anyone has integrated with that API using Processing on a non windows machine?

Hmmm. It should be doable. Using tcp/ip -> http -> ( php -> ) javascript.

thks a lot for your answers guys!
I have an arduino diecimila.
I have all ready tested the buttons and the joystick they all worked fine.
What i m doing right now, which what our teacher said, is to use processing and a picture to emulate what I wanted to do on google earth. I does work. but yes, it would perfect to use on the software it self.
So AlphaBeta, how would I use that plugin with arduino ? Just to remind u, I’m a complete beginner.
I will post u my code soon, in next few hours and c what we could do.

I thk u once again for the great support.

Sonia :wink:

all right, here is the code:

//*************Arduino******************** /* * Sample code to send multiple analog inputs to Processing * from Arduino */

int analogInput1 = 0; int analogInput2 = 1; int val1 = 0; int val2 = 0;

// an identifier for each value char label1 = 'A'; char label2 = 'B';

void setup() { Serial.begin(9600); //setup the serial port }

void loop() { val1 = analogRead(analogInput1); //read pins ito variables val2 = analogRead(analogInput2);

Serial.print (label1, BYTE); Serial.print (val1, DEC); Serial.print (10, BYTE);

Serial.print(label2, BYTE); Serial.print (val2, DEC); Serial.print (10, BYTE);

delay(200); // pause to prevent comm errors

}


//**************** PROCESSING**************** /* * Processing code to receive multiple analog sensor readings * from Arduino * Uses string buffers to hold values larger than 0-255 (byte size) */

import processing.serial.*;

Serial port;

int val; //holds serial line data to send to parser String bufA=""; String bufB=""; //buffer strings for each value int inputFlag; // switches between sensor data for as many sensors as used int val1; //global variables to hold the analog sensor values int val2; PImage b;

//float xCoordinate = 0; //float yCoordinate = 0;

void setup(){ size(400,400); port = new Serial(this,Serial.list()[0],9600); //open serial port stroke(0); strokeWeight(4); b = loadImage("googler.jpg");

}

void draw (){ if(port.available() > 0){ val = port.read(); serialEvent(val); // send the port.read data to the serial parser function image(b, (val1/3-525), (val2/3-25)); // this is the image and val will help go up and down and left and right. //-525 and -25 are the numbers of the joystick, that is the way to put my joystick in the middle of the picture.

//ellipse (val1/3, val2/3, 30, 30); smooth(); //line(20,40,80,40); //print ("A = " ); //println ( val1 ); //print ("B = " ); //println ( val2 ); }

}

void serialEvent(int serial){ if(serial!=10) { // 10 is the line end sent from Arduino if (serial=='A') { //check that buffer is at initial value inputFlag = 1; } if (serial=='B') { inputFlag = 2; }

if (inputFlag == 1){ // fill data into buffer string if (serial!='A') { bufA += char(serial);

} } if (inputFlag == 2){ if (serial!='B') { // fill data into buffer string bufB+= char(serial); } } } else { if (inputFlag == 1){ val1 = int(bufA); // load data into variable from the buffer bufA=""; //clear the buffer } if (inputFlag == 2) { val2 = int(bufB); // load data into variable from the buffer bufB=""; // clear the buffer } }

}

voila! I hope that will help! no idea how to integrate buttons now!