Let's Make Robots!

Virtual Joystick Using Processing and Picaxe!!!


For all that is holy in the world --Watch the Video!!!

Here's what we got:

Processing inputs the posistion of the mouse (x,y). If the mouse is clicked, these cordinates are sent via serial (serial/USB) to a picaxe 28x1 inside of Walter's transmitter. I am using the regular sync cable and plug for this and the serrxd command. From here, the transmitter code is simply dealing with 2 variables, b1 and b2 which used to be coming from the x and y on the manual joystick and sends the same serial data (via RF) to Walter. One note about the Processing code, I chose a background size of 254 by 254 thus the mouse data was confined to 0-254 --the same as the range of the pots on the old joystick.

From here:

I need to do some cleaning up and refining of the code. When things are solid, I get to move on to building a real "virtual control panel" in processing and start adding more features. I am also looking at some Bluetooth moduals I can add to Walter. My new laptop has Bluetooth built in and with this modual, I can eliminate the need for the existing transmitter as a "middle man"... Anyone want to buy me a Bluetooth modual? :)

Code (Processing):

import processing.serial.*;
Serial myPort; 


 void setup() {
       size(254, 254);
       myPort = new Serial(this, "COM15", 4800);
     }


    
    void draw() {
  if (mousePressed && (mouseButton == LEFT)) {
   ;
    myPort.write (104);
    delay (10);
    myPort.write (mouseX);
    delay (10);
    myPort.write (mouseY);
    delay (10);
  }
line(0,0,254,254);
line(254,0,0,254);
     }

Code (Picaxe 28x2):

 'this is a picaxe 28x2 on a test board with a serial LCD for debug testing only

pause 2000
gosub clearscreen

main:
serrxd b0
if b0=104 then gosub numbersin 'consider this a "start byte" (104) is for "10-4 Good, Buddy"
goto main

numbersin:
serrxd b1
serrxd b2
SEROUT 2,T9600_8,("  ",#b1,"  ",#b2,"  ")
goto main



clearscreen:
serout 2,T9600_8,(254,1)
pause 10

return

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Before I realized what was going on I saw the picture and the IDE on the screen and thought you had joined us on the Arduino dark side!

When are we going to be able to RC this via the frontpage of LMR?

There are many guys in here ready to give your wife a ride!

I am actually looking at some object recognition via webcam... "Servers" scare me.
Let me know, i have some stuff for you that might save you some headaches :D 
What & Where?
I have the book from Make called "Making things talk" which pretty much covers communication between the arduino and anything. It also shows the code in a processing enviorement which i think would suit your needs.
No, you can't ride my wife...
lol, quite clever.
Cant wait to see what you do with it next mate. Im really happy your making progress on this. 
Well, I am happy and not afraid. As long as you don't turn evil all the sudden!