-
Notifications
You must be signed in to change notification settings - Fork 0
/
Innovation2021.ino
48 lines (37 loc) · 996 Bytes
/
Innovation2021.ino
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
#define MAX 50
#define DELAY 500
#include <BluetoothSerial.h>
#include <Wire.h>
#include "FallDetection.h"
#include "HeartRate.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
FallDetection mpu;
unsigned long previousmillis;
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32test"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
Wire.begin();
mpu.init();
pinMode(25,INPUT);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
previousmillis = millis();
}
void loop() {
mpu.process();
if ((millis() - previousmillis > DELAY) && (mpu.printenable)) {
printdata(mpu.data);
previousmillis = millis();
}
}
void printdata(String*info){
for (int i=0; i < MAX, info[i] != ""; i++){
Serial.println(info[i]);
SerialBT.println(info[i]);
info[i] = "";
}
}