File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -224,4 +224,13 @@ float RoboHeart::getRotationY(){
224
224
225
225
float RoboHeart::getRotationZ (){
226
226
return this ->_rotationZ ;
227
+ }
228
+
229
+
230
+ float RoboHeart::getTemperatureC (){
231
+ return (imu.readRawTemp () / 256 .) + 25 ;
232
+ }
233
+
234
+ float RoboHeart::getTemperatureF (){
235
+ return (getTemperatureC ()* 1.8 ) + 32 ;
227
236
}
Original file line number Diff line number Diff line change 18
18
#include " RoboHeartStepperMotor.h"
19
19
#include " pins_RoboHeart.h"
20
20
#include < math.h>
21
- #define TRESHOLD 0.1 // treshold in degrees/s
21
+ #define TRESHOLD 0.2 // treshold in degrees/s
22
22
23
23
#define MOTOR_A_CHANNEL1 0
24
24
#define MOTOR_A_CHANNEL2 1
@@ -65,6 +65,8 @@ class RoboHeart {
65
65
static float _driftZ;
66
66
static bool tick;
67
67
static void rotationCallBack (void *pvParameter);
68
+ float getTemperatureC ();
69
+ float getTemperatureF ();
68
70
69
71
private:
70
72
Stream* _debug = NULL ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ void setup() {
20
20
// Set up the RoboHeart
21
21
heart.begin ();
22
22
23
- Serial.println (" RoboHeart MPU Demo" );
23
+ Serial.println (" RoboHeart IMU Demo" );
24
24
}
25
25
26
26
void loop () {
@@ -45,9 +45,9 @@ void loop() {
45
45
46
46
Serial.print (" \n Thermometer:\n " );
47
47
Serial.print (" Degrees C = " );
48
- Serial.println (heart.imu . readTempC (), 4 );
48
+ Serial.println (heart.getTemperatureC (), 4 );
49
49
Serial.print (" Degrees F = " );
50
- Serial.println (heart.imu . readTempF (), 4 );
50
+ Serial.println (heart.getTemperatureF (), 4 );
51
51
F (" =====================================================\n " );
52
52
prevPrintTime = millis ();
53
53
}
You can’t perform that action at this time.
0 commit comments