gabbyshimoni icon

readJoyStickXYvals

gabbyshimoni | PRO | 02/03/19 06:28:07 AM UTC | 0 ⭐ | 440 👁️ | Never ⏰ | []
C++ |

490 B

|

None

|

0 👍

/

0 👎

/*
   03.02.2019
   Written by: Gabby Shimoni
   Description:
   This program reads the X value and Y value of a joystick and print it to Serial monitor
*/
 
#define potXpin A0
#define potYpin A1
int potXval = 0, potYval = 0;
void setup() {
  Serial.begin(9600);
}
 
void loop() {
  potXval = analogRead(potXpin);
  potYval = analogRead(potYpin);
  Serial.print("X value = ");
  Serial.print(potXval);
  Serial.print("   Y value = ");
  Serial.println(potYval);
  delay(100);
}

Comments