Skip to content

Instantly share code, notes, and snippets.

@robertcedwards
Last active March 27, 2019 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertcedwards/9d5b73f94628c49ed22e37c34feee589 to your computer and use it in GitHub Desktop.
Save robertcedwards/9d5b73f94628c49ed22e37c34feee589 to your computer and use it in GitHub Desktop.
Handbrake and sequential shifter
/*
Handbrake with ampping and contrain
Check your range with serial monitor and set your numbers below
*/
void setup() {
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
}
void loop() {
int val = analogRead(0);
val = map(val,550,280, 0, 1024);
val = constrain(val, 0, 1024);//then constrain for noise reduction
Joystick.Z(val);
Serial.println(val);
Joystick.button(11, digitalRead(11));
Joystick.button(12, digitalRead(12));
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment