apuntes_Arduino/TEST/OK-test-Serial-JOY-map/OK-test-Serial-JOY-map.ino

15 lines
272 B
Arduino
Raw Normal View History

2021-01-05 00:15:16 -03:00
#define JoyX A0
void setup() {
Serial.begin(9600);
}
void loop() {
if(analogRead(JoyX) < 525) {
Serial.println(map(analogRead(JoyX),524,0,0,255));
} else if(analogRead(JoyX) > 525) {
Serial.println(map(analogRead(JoyX),526,1023,0,255));
}delay(100);
}