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.
Revision 0:f836fc1bf1d7, committed 2017-07-14
- Comitter:
- oscarvzfz
- Date:
- Fri Jul 14 00:44:21 2017 +0000
- Commit message:
- proyecto ihand;
Changed in this revision
diff -r 000000000000 -r f836fc1bf1d7 beep.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/beep.lib Fri Jul 14 00:44:21 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/dreschpe/code/beep/#d8e14429a95f
diff -r 000000000000 -r f836fc1bf1d7 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Jul 14 00:44:21 2017 +0000
@@ -0,0 +1,89 @@
+#include "mbed.h"
+#include "beep.h"
+
+Beep buzzer(p21);
+Ticker cut;
+
+
+Serial bt(p28,p27);
+Serial pc(USBTX,USBRX);
+
+AnalogIn s_bpm(p20);
+AnalogIn s_temp(p19);
+
+DigitalOut beat(LED1);
+
+char c;
+int setter=0;
+float Threshold=2.615;
+float bpm_val=0;
+float temp_val=0;
+int beatc=0;
+
+
+
+void send_bpm()
+{
+ beatc=beatc*6;
+ if (beatc>130 || beatc<35)
+ {
+ buzzer.beep(1480,2);
+ }
+ bt.printf("%i %.2f\n\r",beatc,temp_val);
+ beatc=0;
+}
+ void send_data()
+{
+ bpm_val=s_bpm*3.3;
+ temp_val=s_temp*3.3*100;
+ bt.printf("%.3f,%.3f\n\r",bpm_val,temp_val);
+}
+
+int main()
+{
+bt.baud(115200);
+
+while(setter == 0)
+{
+if(bt.readable())
+{
+c = bt.getc();
+//bt.printf("%c\n\r",c);
+setter=1;
+}
+}
+
+if(c =='a')
+{
+//bt.printf("a selected\n\r");
+cut.attach(&send_bpm, 10.0);
+}
+
+//if(c =='b')
+//{
+//pc.printf("b selected\n\r");
+//cut.attach(&send_data,.1);
+//}
+
+while(1)
+{
+ bpm_val=s_bpm*3.3;
+ temp_val=s_temp*3.3*100;
+ if(c =='b')
+ {
+ bt.printf("%.3f,%.3f\n\r",bpm_val,temp_val);
+ wait(.01);
+ }
+
+ if(bpm_val > Threshold)
+ {
+ beat=1;
+ wait(.08);
+ beatc++;
+ }
+ else
+ {
+ beat=0;
+ }
+}
+}
\ No newline at end of file
diff -r 000000000000 -r f836fc1bf1d7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jul 14 00:44:21 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/22da6e220af6 \ No newline at end of file