Paso 10: Añadir el código...
Ahora copia el siguiente código a la ventana del software Arduino y carga.
//Arduino Heart Rate Monitor - // Code By DangerousTim//Last edited: 10 Nov 2014#include <LiquidCrystal.h> LiquidCrystal lcd(6, 7, 8, 9, 10, 11);long measurementStartTime = 0; float beats = 0; byte sensorPin = A0; int currentSensorValue; boolean counted = false; float bpm;void setup() { Serial.begin(9600); pinMode(sensorPin, INPUT); lcd.begin(16, 2); }void loop() { while(digitalRead(23) == HIGH){ if (beats == 10){ beats = 0; lcd.clear(); lcd.print("Your BPM is "); bpm = ( (60000/ (millis() - measurementStartTime) ) * 10 ); lcd.print(bpm); measurementStartTime = millis(); } currentSensorValue = analogRead(sensorPin); if (currentSensorValue > 200 && counted == false) { beats++; counted = true; } else if (currentSensorValue < 180) { counted = false; // digitalWrite(beep, LOW); } } }