Last active
May 9, 2018 08:30
-
-
Save uXeBoy/2456bebf58ae36da89e0839cf4966a37 to your computer and use it in GitHub Desktop.
JoyStick.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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