Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Arduino source code: resistive joystick exercise
// Joystick exercise
#define JOYX A0
#define JOYY A1
#define BUTTON 7
int JoyX,JoyY;
boolean Button;
//-- Helper routine for printf()
int s_putc(char c, FILE *t) {
Serial.write(c);
}
void setup() {
Serial.begin (9600);
fdevopen(&s_putc,0); // set up serial output for printf()
Serial.println ("Joystick exercise");
Serial.println ("Ed Nisley - KE4ZNU - May 2017");
pinMode(BUTTON,INPUT_PULLUP);
}
void loop() {
JoyX = analogRead(JOYX);
delay(100);
JoyY = analogRead(JOYY);
delay(100);
Button = digitalRead(BUTTON);
printf("%05d - %05d - %1d\r",JoyX,JoyY,Button);
}
Owner

ednisley commented May 3, 2017

More details on my blog at http://wp.me/poZKh-6J1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment