top of page

Blog #5 Analog Stick Controller


For the past week, I have played with an analog stick controller (called JoyStick V2), which is exact or similar to ones found on game console controllers like Wii. This summer, I am designing a motorized longboard that will be controlled by this analog stick. I decided to pair the joystick to my InspireBot motors and see if I could control it. Successfully I was able to make the InspireBot wheels turn right when I pressed right on the joystick and vice versa. Below is a video of it as well as some Processing code used for the logic. This is just the first step in designing the controller for my motorized longboard!!!

Arduino Processing Code example for Analog Stick

int x = 5, y = 0, valueX, valueY;

void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(11, OUTPUT); }

void loop() { // put your main code here, to run repeatedly: valueX = analogRead(x); valueY = analogRead(y); Serial.print("X = "); Serial.print(valueX); Serial.print(", Y = "); Serial.print(valueY); Serial.println();

if( valueX < 100){ digitalWrite(11, HIGH); analogWrite(13, 255); }

else if( (valueX > 100) && (valueX < 1021) ){ digitalWrite(11, LOW); analogWrite(13, 0); }

if ( valueX > 1021 ) { digitalWrite(11, HIGH); analogWrite(13, -255); }

delay(500); }


Featued Posts 
Recent Posts 
Serach By Tags
No tags yet.
bottom of page