mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Change Xbox LT/LB/RT/RB rumble ref in example
Missed this one in 135608c
.
This commit is contained in:
parent
db31a4d125
commit
8e78fc202e
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue