Skip to content

Commit 363df34

Browse files
author
brentru
committed
update
1 parent cdb0777 commit 363df34

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Wearable_BLE_Temperature_Monitor/ble_temp_monitor.ino

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ float fever_temp = 100.4;
3434
float temp_offset = 0.5;
3535

3636
// Sensor read delay, in minutes
37-
int sensor_delay = 5;
37+
int sensor_delay = 1;
3838

3939
// Measuring your armpit temperature for a minimum of 12 minutes
4040
// is equivalent to measuring your core body temperature.
@@ -119,34 +119,41 @@ void loop() {
119119
Serial.print("Temp: ");
120120
#if defined(TEMPERATURE_F)
121121
float temp = tempsensor.readTempF();
122+
// add temperature offset
123+
temp += temp_offset;
122124
Serial.print(temp);
123125
Serial.println("*F.");
124126
#elif defined(TEMPERATURE_C)
125127
float temp = tempsensor.readTempC();
128+
// add temperature offset
129+
temp += temp_offset;
126130
Serial.print(temp);
127131
Serial.println("*C.");
128132
#else
129133
#warning "Must define TEMPERATURE_C or TEMPERATURE_F!"
130134
#endif
131135

132-
// add temperature offset
133-
temp += temp_offset;
134-
136+
// set NeoPixels to RED if fever_temp
135137
if (temp >= fever_temp) {
136138
pixels.setPixelColor(1, pixels.Color(255, 0, 0));
137139
pixels.show();
138140
}
139141

142+
// float to buffer
140143
snprintf(temperature_buf, sizeof(temperature_buf) - 1, "%0.*f", 1, temp);
144+
141145
if (calibration_time == 0) {
146+
Serial.println("Writing to UART");
142147
// write to UART
143148
bleuart.write(temperature_buf);
144149
}
145150
else {
151+
Serial.print("Calibration time:");
152+
Serial.println(calibration_time);
146153
calibration_time-=1;
147154
}
148155

149-
// shutdown MCP9808 - power consumption ~0.1 mikro Ampere
156+
// shutdown MSP9808 - power consumption ~0.1 mikro Ampere
150157
Serial.println("Shutting down MCP9808");
151158
tempsensor.shutdown_wake(1);
152159

0 commit comments

Comments
 (0)