15 lines
272 B
C++
Executable File
15 lines
272 B
C++
Executable File
#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);
|
|
}
|
|
|