Copyright © Parallax Inc. Page 5 of 5
Arduino Uno
int UD = 0;
int LR = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
UD = analogRead(A0);
LR = analogRead(A1);
Serial.print("UD = ");
Serial.print(UD, DEC);
Serial.print(", LR = ");
Serial.println(LR, DEC);
delay(200);
}
Note: To view the results of the demonstration, after uploading is complete click the Serial
Monitor icon in the Arduino IDE. This displays the Serial Monitor window. Momentarily
depress the Reset button on the Arduino board to restart the sketch
For More Information
• View the 2-Axis Joystick (#27800) product documentation.
• The Parallax 5-Position Switch (#27801) provides another means of providing navigational
control to your project. See the 5-Position Switch KickStart for additional information.