Last active
March 10, 2019 05:44
-
-
Save robertcedwards/18df09bae7e5210a7fe7a262afbf1c57 to your computer and use it in GitHub Desktop.
Handbrake control with mapping for range
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
void setup() { | |
pinMode(0, INPUT_PULLUP); | |
} | |
void loop() { | |
int val = analogRead(0); //read pot value | |
val = map(val, 625, 220, 0, 1024);//map range to normal pot range | |
val = constrain(val, 0, 1024);//then constrain for noise reduction | |
Joystick.X(val); | |
//Serial.println(val) | |
delay(50); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment