Add an equivalent example using the new Joystick API. Also add pin initializing code to Joystick::AddButton()
This commit is contained in:
@ -21,7 +21,10 @@ void Joystick::Init() {
|
||||
if (_debug) Serial.println("DEBUG: Joystick library initialized.");
|
||||
}
|
||||
|
||||
void Joystick::AddButton(uint8_t pin, ButtonType type) {
|
||||
void Joystick::AddButton(uint8_t pin, ButtonType type, bool pullup) {
|
||||
if (pullup) pinMode(pin, INPUT_PULLUP);
|
||||
else pinMode(pin, INPUT);
|
||||
|
||||
_buttons[_num_buttons].pin = pin;
|
||||
_buttons[_num_buttons].type = type;
|
||||
_buttons[_num_buttons].last_state = digitalRead(pin);
|
||||
|
Reference in New Issue
Block a user