Skip to content

Instantly share code, notes, and snippets.

@uXeBoy
Last active May 9, 2018 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uXeBoy/2456bebf58ae36da89e0839cf4966a37 to your computer and use it in GitHub Desktop.
Save uXeBoy/2456bebf58ae36da89e0839cf4966a37 to your computer and use it in GitHub Desktop.
JoyStick.ino
/* Read Joystick
* ------------
*
* Reads two analog pins that are supposed to be
* connected to a joystick made of two potentiometers
*
* http://www.0j0.org | http://arduino.berlios.de
* copyleft 2005 DojoDave for DojoCorp
*/
int joyPin1 = 0; // slider variable connected to analog pin 0
int joyPin2 = 1; // slider variable connected to analog pin 1
int value1 = 0; // variable to read the value from the analog pin 0
int value2 = 0; // variable to read the value from the analog pin 1
void setup() {
Serial.begin(9600);
}
void loop() {
analogRead(joyPin1);
value1 = analogRead(joyPin1);
analogRead(joyPin2);
value2 = analogRead(joyPin2);
Serial.println(value1);
Serial.println(value2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment