-
Notifications
You must be signed in to change notification settings - Fork 0
/
AllSerialHandling.ino
58 lines (47 loc) · 1.53 KB
/
AllSerialHandling.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
49
50
51
52
53
54
55
56
/*
* All Serial Handling Code,
* It's Changeable with the 'serialVisual' variable
* Set it to 'true' or 'false' when it's declared at start of code.
*/
void serialOutputData(){ // Decide How To Output Serial.
if (serialVisual == true){
arduinoSerialMonitorVisual(); // goes to function that makes Serial Monitor Visualizer
} else{
sendDataToSerial();
}
}
// Decides How To OutPut BPM and IBI Data
void serialOutputWhenBeatHappens(){
if (serialVisual == true){ // Code to Make the Serial Monitor Visualizer Work
Serial.print("*** Heart-Beat Happened *** "); //ASCII Art Madness
Serial.print("BPM: ");
Serial.println(BPM);
}
}
void serialOutputWhenMoving() {
if (serialVisual == true){
Serial.println("###### Now Moving ######"); //ASCII Art Madness
}
}
// Sends Data to Pulse Sensor Processing App, Native Mac App, or Third-party Serial Readers.
void sendDataToSerial(){
Serial.print(tCoh * 10);
Serial.print(" ");
Serial.print(AvGsrSignal);
Serial.print(" ");
Serial.println(AvInMotion * 100);
}
// Code to Make the Serial Monitor Visualizer Work
void arduinoSerialMonitorVisual(){
Serial.println("--------------------");
Serial.print("HFR CohVal: ");
Serial.println(tCoh);
Serial.print("minGsrSignal: ");
Serial.println(minGsrSignal);
Serial.print("maxGsrSignal: ");
Serial.println(maxGsrSignal);
Serial.print("AvGsrSignal: ");
Serial.println(AvGsrSignal);
Serial.print("AvInMotion: ");
Serial.println(AvInMotion);
}