mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Format PS3 examples
This commit is contained in:
parent
16c4272358
commit
b50919b077
2 changed files with 173 additions and 193 deletions
|
@ -98,63 +98,43 @@ void loop() {
|
||||||
Serial.print(F("\r\nStart"));
|
Serial.print(F("\r\nStart"));
|
||||||
printAngle = !printAngle;
|
printAngle = !printAngle;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (printAngle) {
|
if (printAngle) {
|
||||||
Serial.print(F("\r\nPitch: "));
|
Serial.print(F("\r\nPitch: "));
|
||||||
Serial.print(PS3.getAngle(Pitch));
|
Serial.print(PS3.getAngle(Pitch));
|
||||||
Serial.print(F("\tRoll: "));
|
Serial.print(F("\tRoll: "));
|
||||||
Serial.print(PS3.getAngle(Roll));
|
Serial.print(PS3.getAngle(Roll));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (PS3.PS3MoveConnected) { // One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB
|
else if (PS3.PS3MoveConnected) { // One can only set the color of the bulb, set the rumble, set and get the bluetooth address and calibrate the magnetometer via USB
|
||||||
switch(state) {
|
if (state == 0) {
|
||||||
case 0:
|
|
||||||
PS3.moveSetRumble(0);
|
PS3.moveSetRumble(0);
|
||||||
PS3.moveSetBulb(Off);
|
PS3.moveSetBulb(Off);
|
||||||
state = 1;
|
} else if (state == 1) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
PS3.moveSetRumble(75);
|
PS3.moveSetRumble(75);
|
||||||
PS3.moveSetBulb(Red);
|
PS3.moveSetBulb(Red);
|
||||||
state = 2;
|
} else if (state == 2) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
PS3.moveSetRumble(125);
|
PS3.moveSetRumble(125);
|
||||||
PS3.moveSetBulb(Green);
|
PS3.moveSetBulb(Green);
|
||||||
state = 3;
|
} else if (state == 3) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
PS3.moveSetRumble(150);
|
PS3.moveSetRumble(150);
|
||||||
PS3.moveSetBulb(Blue);
|
PS3.moveSetBulb(Blue);
|
||||||
state = 4;
|
} else if (state == 4) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
PS3.moveSetRumble(175);
|
PS3.moveSetRumble(175);
|
||||||
PS3.moveSetBulb(Yellow);
|
PS3.moveSetBulb(Yellow);
|
||||||
state = 5;
|
} else if (state == 5) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
PS3.moveSetRumble(200);
|
PS3.moveSetRumble(200);
|
||||||
PS3.moveSetBulb(Lightblue);
|
PS3.moveSetBulb(Lightblue);
|
||||||
state = 6;
|
} else if (state == 6) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
PS3.moveSetRumble(225);
|
PS3.moveSetRumble(225);
|
||||||
PS3.moveSetBulb(Purble);
|
PS3.moveSetBulb(Purble);
|
||||||
state = 7;
|
} else if (state == 7) {
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
PS3.moveSetRumble(250);
|
PS3.moveSetRumble(250);
|
||||||
PS3.moveSetBulb(White);
|
PS3.moveSetBulb(White);
|
||||||
state = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state++;
|
||||||
|
if (state > 7)
|
||||||
|
state = 0;
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue