Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Timer_HelloWorld1 by
main.cpp
00001 #include "mbed.h" 00002 #include "LPC17xx.h" 00003 #include "TextLCD.h" 00004 TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2); 00005 Serial pc (USBTX, USBRX); 00006 PwmOut speaker(p21); 00007 00008 Timer timer; 00009 DigitalOut led(LED1); 00010 int begin, end; 00011 int beats=0; 00012 int b=0; 00013 int hr=0; 00014 int samplerate=10; 00015 00016 int main() { 00017 timer.start(); 00018 00019 while (1){ 00020 b=timer.read(); 00021 00022 hr = (b * 60)/samplerate; 00023 lcd.locate(0,1); 00024 lcd.printf("Beats %d" ,b); 00025 if (hr<100) 00026 { 00027 00028 lcd.locate(0,0); 00029 lcd.printf("heart fine "); 00030 } 00031 00032 if (hr>=100) 00033 { 00034 lcd.cls(); 00035 //lcd.locate(0,0); 00036 //lcd.printf("Alarm %d", hr); 00037 speaker.period(1.0/500.0); // 500hz period 00038 speaker =0.5; 00039 timer.reset(); 00040 } 00041 speaker=0.0; // turn off audio 00042 00043 } 00044 00045 //begin = timer.read_us(); 00046 led = !led; 00047 //end = timer.read_us(); 00048 //printf("Toggle the led takes %d us", end - begin); 00049 }
Generated on Thu Jul 14 2022 12:19:16 by
1.7.2
