![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
PULSE_SENSOR_LCD16X2
Dependencies: PulseSensor TextLCD_AND_PULSE_SENSOR
Diff: main.cpp
- Revision:
- 1:52ef36eb7a73
- Parent:
- 0:8d3802709c6c
diff -r 8d3802709c6c -r 52ef36eb7a73 main.cpp --- a/main.cpp Sun Nov 12 03:35:57 2017 +0000 +++ b/main.cpp Tue Feb 22 19:51:52 2022 +0000 @@ -1,27 +1,39 @@ #include "mbed.h" #include "PulseSensor.h" - -Serial pc(USBTX, USBRX); - - -/** Print the data in a format that can be parsed by the - * Processing application available here: http://pulsesensor.myshopify.com/pages/code-and-guide - */ +#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') pc.printf("%c%d\r\n", symbol, data); + if(symbol == 'B') { + rate=data; + } + } - - - -int main() { - +int main() +{ + button.rise(&count); PulseSensor sensor(A0, sendDataToProcessing); - - pc.baud(115200); - + 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++;; +} \ No newline at end of file