-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.c
450 lines (375 loc) · 16.3 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
#include <Wire.h> //I2C communication
#include <Adafruit_GFX.h> //OLED screen
#include <Adafruit_SSD1306.h> ////OLED screen
#include <Adafruit_Sensor.h> //BMP180
#include <Adafruit_BMP085.h> //BMP180
#include "BluetoothSerial.h" //Bluetooth library import
#include "DHT.h" //DHT22 library
//MAX10302
#include "MAX30105.h"
#include "heartRate.h"
//----Current implemented-----//
//Hall effect
//OLED
//Bluetooth
//-----To Do
//Heart Rate
//Temperature
//Preasure altitude
//Humidity
//Logo Btmap
const unsigned char logoMischianti[1024] PROGMEM = {
// 'logoBN128x64, 128x64px
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc6, 0x00, 0x01, 0xff, 0xfe, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x86, 0x00, 0x11, 0xff, 0xf8, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x3f, 0x0c, 0x00, 0x01, 0xff, 0xe0, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x3e, 0x1c, 0x7f, 0xe3, 0xff, 0xc3, 0xc1, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x1c, 0x3c, 0x7f, 0xe3, 0xff, 0x87, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x1c, 0x78, 0x7f, 0xc3, 0xff, 0x0f, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x78, 0x00, 0xc7, 0xff, 0x0f, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x10, 0xf8, 0x01, 0xc7, 0xfe, 0x1f, 0xe1, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x01, 0xf0, 0x01, 0x87, 0xfe, 0x1f, 0xc3, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x03, 0xf1, 0xff, 0x8f, 0xfe, 0x1f, 0xc3, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x07, 0xf1, 0xff, 0x8f, 0xfe, 0x1f, 0x87, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x07, 0xe3, 0xff, 0x1f, 0xfe, 0x0f, 0x0f, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x0f, 0xe0, 0x00, 0x00, 0x07, 0x00, 0x1f, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x1f, 0xe0, 0x01, 0x00, 0x0f, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x3f, 0xc0, 0x00, 0x00, 0x0f, 0xc1, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf8, 0x00, 0x08, 0xe2, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xf0, 0x00, 0x18, 0xe4, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xe7, 0xe3, 0xf0, 0x61, 0xf8, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xe0, 0x20, 0x70, 0x48, 0x08, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xf0, 0x00, 0x70, 0x0c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x0f, 0xe6, 0x0f, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x0f, 0xe6, 0x1f, 0xc3, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc0, 0x00, 0x67, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x80, 0x4f, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
//Macros
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define BUTTON_1_PIN 35 // Button 1 Pin 35
#define BUTTON_2_PIN 32 // Button 2 Pin 35
#define HALL_EFFECT 33 //Hall effects
#define DHTPIN 26 //define DHT22 pin
#define DHTTYPE DHT22 //Define DHT edition in this case 22
//Timer starts here
double start_time;
double diff_ms_time = 0;
int minute_time = 0;
int seco_time = 0;
int hrs_time = 0;
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); //create OLED instance
Adafruit_BMP085 bme; //create BMP180 instance
BluetoothSerial SerialBT; //create bluetooth instance
//Max30102 start
MAX30105 particleSensor; //create MAX10302 instance
String RcvdCmd; //Store recived bluetooth Command
DHT dht(DHTPIN, DHTTYPE); //create dht 22 instance
const byte RATE_SIZE = 4; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
float beatsPerMinute;
int beatAvg;
//Max30102 end
//Sesnor check variables
int maxs = 1;
int oled = 1;
int bmp = 1;
//menu position
int menu_pos = 2;
//bluetooth
int Blt = 0;
//Time last hall effect sense occured
double lsthalls = 0;
double time_gap = 0;
float speed = 0;
float speed_val = 0;
//Hardware Intrupt Button--Start
struct Button {
const uint8_t PIN;//uint8_t should check
uint32_t numberKeyPresses;//Not used
bool pressed;//Not used
};
Button button1 = { BUTTON_1_PIN, 0, false };
Button button2 = { BUTTON_2_PIN, 0, false };
Button hall_effect = { HALL_EFFECT, 0, false };
//Hardware Intruption
void IRAM_ATTR isr() {//Button1
//button1.numberKeyPresses++;
//button1.pressed = true;
menu_pos++;
//button1.pressed = false;
//Serial.println("Hall Effect detected");
}
void IRAM_ATTR isr2() {//Button2
//button2.numberKeyPresses++;
//button2.pressed = true;
//Serial.println("Hall Effect detected");
menu_pos--;
//button1.pressed = false;
}
void IRAM_ATTR isr3() {//Hall Effect Sensor
//hall_effect.numberKeyPresses++;
time_gap = millis() - lsthalls;
lsthalls = millis();
speed = (1000.0 / time_gap);
hall_effect.pressed = true;
speed_val = (2 * 3.14 * 0.15 * speed) * 3.6;//r=0.15
//Serial.println("Hall Effect detected");
}
// Using for Thread
TaskHandle_t Task1;
TaskHandle_t Task2;
//Using for temperature & altitude reading
String altString = "";
String temperatureString = "";
unsigned long previousMillis = 0; // Stores last time temperature was published
const long interval = 10000; // interval at which to publish sensor readings
//Run at power Up
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32"); //Bluetooth device name
//pinMode(BUTTON_1_PIN, INPUT_PULLUP);
//pinMode(BUTTON_2_PIN, INPUT_PULLUP);
//pinMode(HALL_EFFECT, INPUT_PULLUP); //Hall effects
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {//0x3C is oled address
Serial.println(F("SSD1306 allocation failed"));
}
//OLED startup config
//delay(2000);
display.clearDisplay();
//Button 1&2
pinMode(button1.PIN, INPUT_PULLUP);//Get pin inputs
attachInterrupt(button1.PIN, isr, FALLING);//Faling refers to Voltage Falling
pinMode(button2.PIN, INPUT_PULLUP);//Get pin inputs
attachInterrupt(button2.PIN, isr2, FALLING);//Faling refers to Voltage Falling
//Hall Effect
pinMode(hall_effect.PIN, INPUT_PULLUP);//Get pin inputs
attachInterrupt(hall_effect.PIN, isr3, FALLING);//Faling refers to Voltage Falling
//BMP180 startup
bool status = bme.begin(0x77);//I2C address 0x77
if (!bme.begin()) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
//bmp = 0;
}
dht.begin(); //DHT22 begin sendig data
//display.clearDisplay();
// Initialize MAX30102
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
//maxs = 0;
}
Serial.println("Place your index finger on the sensor with steady pressure.");
particleSensor.setup(); //Configure sensor with default settings
particleSensor.setPulseAmplitudeRed(0x0A); //Turn Red LED to low to indicate sensor is running
particleSensor.setPulseAmplitudeGreen(0); //Turn off Green LED
//create a task that will be executed in the Task1code() function, with priority 1 and executed on core 0
xTaskCreatePinnedToCore(
Task1code, /* Task function. */
"Task1", /* name of task. */
10000, /* Stack size of task */
NULL, /* parameter of the task */
1, /* priority of the task */
&Task1, /* Task handle to keep track of created task */
0); /* pin task to core 0 */
delay(500);
//create a task that will be executed in the Task2code() function, with priority 1 and executed on core 1
xTaskCreatePinnedToCore(
Task2code, /* Task function. */
"Task2", /* name of task. */
10000, /* Stack size of task */
NULL, /* parameter of the task */
1, /* priority of the task */
&Task2, /* Task handle to keep track of created task */
1); /* pin task to core 1 */
delay(500);
}
//Task1code:heartrate
void Task1code(void* pvParameters) {
Serial.print("Task1 running on core ");
Serial.println(xPortGetCoreID());
for (;;) {//Run as loop
long irValue = particleSensor.getIR();
if (checkForBeat(irValue) == true) {
long delta = millis() - lastBeat;
lastBeat = millis();
beatsPerMinute = 60 / (delta / 1000.0);
if (beatsPerMinute < 255 && beatsPerMinute > 20) {
rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
rateSpot %= RATE_SIZE; //Wrap variable
//Take average of readings
beatAvg = 0;
for (byte x = 0; x < RATE_SIZE; x++)
beatAvg += rates[x];
beatAvg /= RATE_SIZE;
}
}
}
}
//Run as loop
//Task2code:Display & bluetooth
void Task2code(void* pvParameters) {
Serial.print("Task2 running on core ");
Serial.println(xPortGetCoreID());
display.drawBitmap(0, 0, logoMischianti, 128, 64, WHITE);
display.display();
display.setTextColor(WHITE);
/*
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.print("Welcome");
//display.setCursor(2, 0);
//display.print("Velo Sense");
display.setCursor(4, 0);
display.print("Loading Please Wait");
display.display();
*/
delay(5000);
start_time = millis(); //Timer get start Time
for (;;) {
//DHT22 Reading
float hum = dht.readHumidity();
// Read temperature as Celsius (the default)
float temp = bme.readTemperature();
display.clearDisplay();
// display temperature on OLED
//Timer Dsplay
seco_time = (millis() - start_time) / 1000;
if (seco_time >= 60) {
minute_time = seco_time / 60;
seco_time = seco_time % 60;
if (minute_time >= 60) {
hrs_time = minute_time / 60;
minute_time = minute_time % 60;
} else {
hrs_time = 0;
}
} else {
minute_time = 0;
hrs_time = 0;
}
display.setTextSize(1);
display.setCursor(0, 0);
if (menu_pos < 0) {
menu_pos = 3;
} else if (menu_pos > 3) {
menu_pos = 0;
}
switch (menu_pos) {
case 0:
display.print("Temperature: ");
display.setTextSize(2);
display.setCursor(0, 10);
display.print(String(bme.readTemperature()));
display.print(" ");
display.setTextSize(1);
display.cp437(true);
display.write(167);
display.setTextSize(2);
display.print("C");
display.setCursor(0, 25);
display.setTextSize(2);
//display.print(RcvdCmd);
break;
case 1:
display.print("Altitude: ");
display.setTextSize(2);
display.setCursor(0, 10);
display.print(String(bme.readAltitude()));
display.print("m");
break;
case 2:
display.print("Speed: ");
display.setTextSize(2);
display.setCursor(0, 10);
display.print(String(speed_val));
display.setTextSize(2);
display.print("km/h");
break;
case 3:
display.print("Env Temp: ");
display.setTextSize(2);
display.setCursor(0, 10);
display.print(String(beatsPerMinute));
display.print(" ");
display.setTextSize(1);
display.cp437(true);
display.write(167);
display.setTextSize(2);
display.print("C");
break;
}
if (minute_time >= 1) {
display.setCursor(15, 50);
display.print(String(hrs_time) + ":" + String(minute_time) + ":" + String(seco_time));
} else {
display.setCursor(10, 30);
display.setTextSize(1);
display.print(String("Waiting to Start"));
display.setCursor(10, 42);
display.print(String("the Session!"));
}
//display.println(" ");
Serial.println(String(display.getCursorX()) + " " + String(display.getCursorY()));
display.display();
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
temperatureString = String(bme.readTemperature());
//SerialBT.println(temperatureString);
//Altitude
altString = String(bme.readAltitude());
SerialBT.println(temperatureString + "|" + altString + "|" + beatAvg + "|" + hum + "|" + temp + "|" + speed);
speed = 0;
speed_val = 0;
}
// Send temperature readings via bluetooth communication
delay(1000);
}
}
void loop() {
}