mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Only print if the IR camera is actually seeing something
This commit is contained in:
parent
fed2a0ad07
commit
0cd5102056
1 changed files with 44 additions and 35 deletions
|
@ -43,21 +43,22 @@ void loop() {
|
||||||
else {
|
else {
|
||||||
if(Wii.getButtonClick(ONE))
|
if(Wii.getButtonClick(ONE))
|
||||||
Wii.IRinitialize(); // Run the initialisation sequence
|
Wii.IRinitialize(); // Run the initialisation sequence
|
||||||
if(Wii.getButtonClick(MINUS)) {
|
if(Wii.getButtonClick(MINUS) || Wii.getButtonClick(PLUS)) {
|
||||||
if(!Wii.isIRCameraEnabled())
|
if(!Wii.isIRCameraEnabled())
|
||||||
Serial.print(F("\r\nEnable IR camera first"));
|
Serial.print(F("\r\nEnable IR camera first"));
|
||||||
else {
|
else {
|
||||||
|
if(Wii.getButtonPress(MINUS)) { // getButtonClick will only return true once
|
||||||
if(printObjects > 0)
|
if(printObjects > 0)
|
||||||
printObjects--;
|
printObjects--;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(Wii.getButtonClick(PLUS)) {
|
|
||||||
if(!Wii.isIRCameraEnabled())
|
|
||||||
Serial.print(F("\r\nEnable IR camera first"));
|
|
||||||
else {
|
else {
|
||||||
if(printObjects < 4)
|
if(printObjects < 4)
|
||||||
printObjects++;
|
printObjects++;
|
||||||
}
|
}
|
||||||
|
Serial.print(F("\r\nTracking "));
|
||||||
|
Serial.print(printObjects);
|
||||||
|
Serial.print(F(" objects"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(Wii.getButtonClick(A)) {
|
if(Wii.getButtonClick(A)) {
|
||||||
printAngle = !printAngle;
|
printAngle = !printAngle;
|
||||||
|
@ -69,37 +70,45 @@ void loop() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(printObjects > 0) {
|
if(printObjects > 0) {
|
||||||
Serial.print(F("\r\ny1: "));
|
if(Wii.getIRx1() != 0x3FF || Wii.getIRy1() != 0x3FF || Wii.getIRs1() != 0) { // Only print if the IR camera is actually seeing something
|
||||||
Serial.print(Wii.getIRy1());
|
Serial.print(F("\r\nx1: "));
|
||||||
Serial.print(F("\tx1: "));
|
|
||||||
Serial.print(Wii.getIRx1());
|
Serial.print(Wii.getIRx1());
|
||||||
|
Serial.print(F("\ty1: "));
|
||||||
|
Serial.print(Wii.getIRy1());
|
||||||
Serial.print(F("\ts1:"));
|
Serial.print(F("\ts1:"));
|
||||||
Serial.print(Wii.getIRs1());
|
Serial.print(Wii.getIRs1());
|
||||||
|
}
|
||||||
if(printObjects > 1) {
|
if(printObjects > 1) {
|
||||||
Serial.print(F("\t\ty2: "));
|
if(Wii.getIRx2() != 0x3FF || Wii.getIRy2() != 0x3FF || Wii.getIRs2() != 0) {
|
||||||
Serial.print(Wii.getIRy2());
|
Serial.print(F("\r\nx2: "));
|
||||||
Serial.print(F("\tx2: "));
|
|
||||||
Serial.print(Wii.getIRx2());
|
Serial.print(Wii.getIRx2());
|
||||||
|
Serial.print(F("\ty2: "));
|
||||||
|
Serial.print(Wii.getIRy2());
|
||||||
Serial.print(F("\ts2:"));
|
Serial.print(F("\ts2:"));
|
||||||
Serial.print(Wii.getIRs2());
|
Serial.print(Wii.getIRs2());
|
||||||
|
}
|
||||||
if(printObjects > 2) {
|
if(printObjects > 2) {
|
||||||
Serial.print(F("\t\ty3: "));
|
if(Wii.getIRx3() != 0x3FF || Wii.getIRy3() != 0x3FF || Wii.getIRs3() != 0) {
|
||||||
Serial.print(Wii.getIRy3());
|
Serial.print(F("\r\nx3: "));
|
||||||
Serial.print(F("\tx3: "));
|
|
||||||
Serial.print(Wii.getIRx3());
|
Serial.print(Wii.getIRx3());
|
||||||
|
Serial.print(F("\ty3: "));
|
||||||
|
Serial.print(Wii.getIRy3());
|
||||||
Serial.print(F("\ts3:"));
|
Serial.print(F("\ts3:"));
|
||||||
Serial.print(Wii.getIRs3());
|
Serial.print(Wii.getIRs3());
|
||||||
|
}
|
||||||
if(printObjects > 3) {
|
if(printObjects > 3) {
|
||||||
Serial.print(F("\t\ty4: "));
|
if(Wii.getIRx4() != 0x3FF || Wii.getIRy4() != 0x3FF || Wii.getIRs4() != 0) {
|
||||||
Serial.print(Wii.getIRy4());
|
Serial.print(F("\r\nx4: "));
|
||||||
Serial.print(F("\tx4: "));
|
|
||||||
Serial.print(Wii.getIRx4());
|
Serial.print(Wii.getIRx4());
|
||||||
|
Serial.print(F("\ty4: "));
|
||||||
|
Serial.print(Wii.getIRy4());
|
||||||
Serial.print(F("\ts4:"));
|
Serial.print(F("\ts4:"));
|
||||||
Serial.print(Wii.getIRs4());
|
Serial.print(Wii.getIRs4());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(printAngle) { // There is no extension bytes avaliable, so the Motionplus or Nunchuck can't be read
|
if(printAngle) { // There is no extension bytes avaliable, so the Motionplus or Nunchuck can't be read
|
||||||
Serial.print(F("\r\nPitch: "));
|
Serial.print(F("\r\nPitch: "));
|
||||||
Serial.print(Wii.getPitch());
|
Serial.print(Wii.getPitch());
|
||||||
|
|
Loading…
Reference in a new issue