PULSE_SENSOR_LCD16X2
Dependencies: PulseSensor TextLCD_AND_PULSE_SENSOR
main.cpp
- Committer:
- EDISON_NGUNJIRI
- Date:
- 2022-02-23
- Revision:
- 2:6f02822e170d
- Parent:
- 1:52ef36eb7a73
File content as of revision 2:6f02822e170d:
#include "mbed.h" #include "PulseSensor.h" #include "TextLCD.h" #include <stdio.h> #include <string.h> void count(); DigitalIn Press(PB_5); TextLCD lcd(PA_5, PA_6, PA_7, PA_8, PA_9, PA_10);// RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780 InterruptIn button(PC_13); int rate,Press_Count=0; void sendDataToProcessing(char symbol, int data) { if(symbol == 'B') { rate=data; } } int main() { button.rise(&count); PulseSensor sensor(A0, sendDataToProcessing); pc.baud(9600); sensor.start(); while(1) { lcd.cls() ; // clear screen lcd.locate(0,0); lcd.printf("PULSE RATE=%d",rate); lcd.locate(0,1); lcd.printf("PRESS COUNT=%d ",Press_Count); wait(1) ; // wait for 2s } } void count() { Press_Count++;; }