mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Added getTemperature()
This commit is contained in:
parent
053786b125
commit
d251a48fb1
4 changed files with 17 additions and 15 deletions
13
PS3BT.cpp
13
PS3BT.cpp
|
@ -521,6 +521,19 @@ double PS3BT::getAngle(Angle a) {
|
|||
return angle;
|
||||
}
|
||||
}
|
||||
String PS3BT::getTemperature() {
|
||||
if(PS3MoveConnected) {
|
||||
int16_t input = getSensor(tempMove);
|
||||
|
||||
String output = String(input/100);
|
||||
output += ".";
|
||||
if(input%100 < 10)
|
||||
output += "0";
|
||||
output += String(input%100);
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
bool PS3BT::getStatus(Status c)
|
||||
{
|
||||
if (l2capinbuf == NULL)
|
||||
|
|
1
PS3BT.h
1
PS3BT.h
|
@ -353,6 +353,7 @@ public:
|
|||
double getAngle(Angle a);
|
||||
bool getStatus(Status c);
|
||||
String getStatusString();
|
||||
String getTemperature();
|
||||
void disconnect(); // use this void to disconnect any of the controllers
|
||||
|
||||
/* HID Commands */
|
||||
|
|
|
@ -189,21 +189,8 @@ void loop()
|
|||
Serial.println(PS3.getAngle(Roll));
|
||||
}
|
||||
else if(printTemperature) {
|
||||
String templow;
|
||||
String temphigh;
|
||||
String input = String(PS3.getSensor(tempMove));
|
||||
|
||||
if (input.length() > 3) {
|
||||
temphigh = input.substring(0, 2);
|
||||
templow = input.substring(2);
|
||||
} else {
|
||||
temphigh = input.substring(0, 1);
|
||||
templow = input.substring(1);
|
||||
}
|
||||
Serial.print(F("Temperature: "));
|
||||
Serial.print(temphigh);
|
||||
Serial.print(F("."));
|
||||
Serial.println(templow);
|
||||
Serial.print(F("Temperature: "));
|
||||
Serial.println(PS3.getTemperature());
|
||||
}
|
||||
}
|
||||
delay(1);
|
||||
|
|
|
@ -22,6 +22,7 @@ getSensor KEYWORD2
|
|||
getAngle KEYWORD2
|
||||
getStatus KEYWORD2
|
||||
getStatusString KEYWORD2
|
||||
getTemperature KEYWORD2
|
||||
disconnect KEYWORD2
|
||||
|
||||
setAllOff KEYWORD2
|
||||
|
|
Loading…
Reference in a new issue