Change Xbox LT/LB/RT/RB rumble ref in example

Missed this one in 135608c.
This commit is contained in:
David Madison 2021-07-05 04:26:13 -04:00
parent db31a4d125
commit 8e78fc202e

View file

@ -64,12 +64,12 @@ void loop() {
}
// Set rumble effect
static uint16_t oldL2Value, oldR2Value;
if (Xbox.getButtonPress(L2) != oldL2Value || Xbox.getButtonPress(R2) != oldR2Value) {
oldL2Value = Xbox.getButtonPress(L2);
oldR2Value = Xbox.getButtonPress(R2);
uint8_t leftRumble = map(oldL2Value, 0, 1023, 0, 255); // Map the trigger values into a byte
uint8_t rightRumble = map(oldR2Value, 0, 1023, 0, 255);
static uint16_t oldLTValue, oldRTValue;
if (Xbox.getButtonPress(LT) != oldLTValue || Xbox.getButtonPress(RT) != oldRTValue) {
oldLTValue = Xbox.getButtonPress(LT);
oldRTValue = Xbox.getButtonPress(RT);
uint8_t leftRumble = map(oldLTValue, 0, 1023, 0, 255); // Map the trigger values into a byte
uint8_t rightRumble = map(oldRTValue, 0, 1023, 0, 255);
if (leftRumble > 0 || rightRumble > 0)
Xbox.setRumbleOn(leftRumble, rightRumble, leftRumble, rightRumble);
else