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.
Dependencies: mbed
Fork of EDP2_display by
Revision 5:4152a51f0724, committed 2018-03-07
- Comitter:
- raduschirila
- Date:
- Wed Mar 07 14:45:18 2018 +0000
- Parent:
- 4:82c807b7685e
- Child:
- 6:66dca4356808
- Commit message:
- test;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Mar 06 16:19:18 2018 +0000
+++ b/main.cpp Wed Mar 07 14:45:18 2018 +0000
@@ -21,6 +21,7 @@
Serial pc(USBTX, USBRX); // tx, rx this is for the data to be sent via the usb port to the computer
Ticker pulse,freq,display_rate;
+InterruptIn button(PTD5);
AnalogIn pulse_in(PTB0);
AnalogOut o(PTE30);
DigitalOut led(PTD5);
@@ -29,7 +30,11 @@
int q=0;
bool first=true;
-
+inline bool slope(float f[80])
+{
+ float r=(f[9]-f[3])/6;
+ return( (r>-0.01 && r<-0.03) ? true: false);
+}
void get_pulse()
{
@@ -44,11 +49,12 @@
first=false;
//normalization procedure
v[q-1]=y-(sum/(float)q)+0.1;//normalization procedure raw pulse value minus the trendline(running average)
- o=v[q-1];
+ //o=v[q-1];
if(q==80) {
q=0;
sum=sum/80;
}
+ if(slope) frq++;
}
@@ -74,7 +80,7 @@
char thirtn[8]= {0x4f,0x41,0x41,0x4f,0x41,0x41,0x41,0x4f};
char fourtn[8]= {0x49,0x49,0x49,0x4f,0x41,0x41,0x41,0x41};
char fiftn[8]= {0x4f,0x48,0x48,0x4f,0x41,0x41,0x41,0x4f};
-
+char wave[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
//DISPLAY FUNCTIONS DO NOT TOUCH
@@ -166,6 +172,10 @@
}
char wave[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01};
+void frq()
+{
+
+
void disp()
{
int steps=v[q]/0.0125;
@@ -181,9 +191,9 @@
int main()
{
+ splash_screen();//wait for the pulse to be stable by showing stuff on the display so the user is happy
pulse.attach(&get_pulse,0.0125);//attach the interrupt thing so it starts the ISR every 0.0125 s
-
- //splash_screen();//wait for the pulse to be stable by showing stuff on the display so the user is happy knowing he is gay
+ button.rise(%frq);
display_rate.attach(&disp,0.1);
while(1) {
}
