Open gianlazz opened 7 years ago
ee27e02728fdb9c266c8bbf8ac9dbac70f99689a
I have added the chart to the processing UI Code for the heart rate. It's just a line graph
Same as the issue mentioned in this link: https://github.com/sameezch/OMNI-BAND/issues/12
"Make each sensor a float data set that we use"
"Use Fahrenheit because MERICA"
Take Heart Rate serial integer value 0-1024 and turn less than 550 into 0.0 and over 550 into 1.0 (as float variables) so that we can show the high points on the sinewave as heartbeats and low points as pauses.
int Signal; // holds the incoming raw data. Signal value can range from 0-1024
int Threshold = 550; // Determine which Signal to "count as a beat", and which to ingore.
// The Main Loop Function
void loop() {
Signal = analogRead(PulseSensorPurplePin); // Read the PulseSensor's value.
// Assign this value to the "Signal" variable.
Serial.println(Signal); // Send the Signal value to Serial Plotter.
if(Signal > Threshold){ // If the signal is above "550", then "turn-on" Arduino's on-Board LED.
digitalWrite(LED13,HIGH);
} else {
digitalWrite(LED13,LOW); // Else, the sigal must be below "550", so "turn-off" this LED.
}
How do I get the serial heart rate int of 0-1024 into the processing sketch?
Solved in Omni.pde in this commit: 4a5a6563724460839b5abf58739948cb122dd9f1
Making new issue to merge in the Omni.pde code to display arduino serial text in a processing window.
Here's the issue where I merge the serial text draw method into the primary ProseccingUI.pde sketch: https://github.com/sameezch/OMNI-BAND/issues/14https://github.com/sameezch/OMNI-BAND/issues/14
"Created Implement-HeartRate-Float-Into-Graph branch for myself to work on this feature in."
resuming work here as a duplicate issue was started for this feature https://github.com/sameezch/OMNI-BAND/issues/16
How do I pipe in the serial output data from just one sensor? Do I have to parse the text for a keyword?
Below is the line of code where I'll implement my heartrate float.
myChart.setData("incoming", new float[100]);
@sameezch Here's some sudo code
and leads on search terms that may lead to supporting discussions or documentation:
Arduino:
void heartRateIfLoop() {
if (heartRateValue =+ 550)
{
heartFloatVariable = 1.0
}
else if (heartRateValue =- 550)
heartFloatVariable = 0.0
}
Processing
///idk the best way to get heartFloatVariable from arduino to processing to implement it into this UI element
myChart.setData("incoming, new float[heartFloatVariable]);
Let's try i2c.list() and see what it prints. From there we can specify sensors to different variables. As for the HR we can use the serial function.
I like that!
On Jun 4, 2017 12:04 PM, "sameezch" notifications@github.com wrote:
Let's try i2c.list() and see what it prints. From there we can specify sensors to different variables. As for the HR we can use the serial function.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/sameezch/OMNI-BAND/issues/11#issuecomment-306060089, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHM856k1FM5Kf88pjzQbDbQgzcM6kRBks5sAv_MgaJpZM4NvN7a .
Hey! We should use port.bufferUntil().
https://processing.org/reference/libraries/serial/Serial_bufferUntil_.html
We will just set different characters for each sensor
[ ] Create float variables
[ ] Set different characters for each sensor in the Arduino code and upload it
[ ] Parse the string as a float
http://www.sojamo.de/libraries/controlP5/examples/controllers/ControlP5chart/ControlP5chart.pde
accepts float variable