[vc_row][vc_column][vc_column_text][/vc_column_text][vc_tour][vc_tab title=”Interface” tab_id=”1396976781-1-44″][vc_column_text]Wire the signal to one of the ADC pin of Arduino.
[/vc_column_text][/vc_tab][vc_tab title=”Arduino Sample Code” tab_id=”1396976781-2-55″][vc_column_text]
// Pulse Monitor Test Script int ledPin = 13; int sensorPin = 0; double alpha = 0.75; int period = 20; double change = 0.0; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(115200); } void loop() { static double oldValue = 0; static double oldChange = 0; int rawValue = analogRead(sensorPin); double value = alpha * oldValue + (1 - alpha) * rawValue; Serial.print(rawValue); Serial.print(","); Serial.println(value); oldValue = value; delay(period); }
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.