From 33698b0091fb58ae01da3fd76a6742e0287532df Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Sun, 6 Jan 2013 03:32:13 +0100 Subject: [PATCH] Fixed issue that caused setLed to not respond and check batterylevel --- examples/Xbox/XBOXRECV/XBOXRECV.ino | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/Xbox/XBOXRECV/XBOXRECV.ino b/examples/Xbox/XBOXRECV/XBOXRECV.ino index 3f3d5866..b6ae3b23 100644 --- a/examples/Xbox/XBOXRECV/XBOXRECV.ino +++ b/examples/Xbox/XBOXRECV/XBOXRECV.ino @@ -22,15 +22,13 @@ void loop() { if(Xbox.XboxReceiverConnected) { for(uint8_t i=0;i<4;i++) { if(Xbox.Xbox360Connected[i]) { - if(Xbox.getButtonPress(i,L2)) { + if(Xbox.getButtonPress(i,L2) || Xbox.getButtonPress(i,R2)) { Serial.print("L2: "); - Serial.println(Xbox.getButtonPress(i,L2)); + Serial.print(Xbox.getButtonPress(i,L2)); + Serial.print("\tR2: "); + Serial.println(Xbox.getButtonPress(i,R2)); + Xbox.setRumbleOn(i,Xbox.getButtonPress(i,L2),Xbox.getButtonPress(i,R2)); } - if(Xbox.getButtonPress(i,R2)) { - Serial.print("R2: "); - Serial.println(Xbox.getButtonPress(i,R2)); - } - Xbox.setRumbleOn(i,Xbox.getButtonPress(i,L2),Xbox.getButtonPress(i,R2)); if(Xbox.getAnalogHat(i,LeftHatX) > 7500 || Xbox.getAnalogHat(i,LeftHatX) < -7500 || Xbox.getAnalogHat(i,LeftHatY) > 7500 || Xbox.getAnalogHat(i,LeftHatY) < -7500 || Xbox.getAnalogHat(i,RightHatX) > 7500 || Xbox.getAnalogHat(i,RightHatX) < -7500 || Xbox.getAnalogHat(i,RightHatY) > 7500 || Xbox.getAnalogHat(i,RightHatY) < -7500) { if(Xbox.getAnalogHat(i,LeftHatX) > 7500 || Xbox.getAnalogHat(i,LeftHatX) < -7500) { Serial.print(F("LeftHatX: ")); @@ -90,7 +88,9 @@ void loop() { Serial.println(F("R1")); if(Xbox.getButtonClick(i,XBOX)) { Xbox.setLedMode(i,ROTATING); - Serial.println(F("Xbox")); + Serial.print(F("Xbox (Battery: ")); + Serial.print(Xbox.getBatteryLevel(i)); + Serial.println(F("%)")); } if(Xbox.getButtonClick(i,SYNC)) Serial.println(F("Sync"));