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 Servo LSM9DS1_Library_
Revision 1:d22b2e802de9, committed 2020-02-26
- Comitter:
- kzkyuta
- Date:
- Wed Feb 26 03:01:40 2020 +0000
- Parent:
- 0:f66784158dab
- Child:
- 2:bb491c4aa97b
- Commit message:
- This version is for spontaneous blink detection ;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Feb 26 02:49:19 2020 +0000 +++ b/main.cpp Wed Feb 26 03:01:40 2020 +0000 @@ -33,7 +33,7 @@ unsigned short counter_wait; unsigned short position; -#define THRESHOLD 800 +#define THRESHOLD 500 #define THRESHOLD_VOL -100 DigitalOut rled(P0_15); @@ -81,9 +81,12 @@ position ++; int tempPos = position % ARRAY_SIZE; - array_0[tempPos] = (val_0 + array_0[ARRAY_SIZE - 1] + array_0[ARRAY_SIZE - 2] + array_0[ARRAY_SIZE - 3])/3; - array_1[tempPos] = (val_1 + array_1[ARRAY_SIZE - 1] + array_1[ARRAY_SIZE - 2] + array_1[ARRAY_SIZE - 3])/3; - array_2[tempPos] = (val_2 + array_2[ARRAY_SIZE - 1] + array_2[ARRAY_SIZE - 2] + array_2[ARRAY_SIZE - 3])/3; + //array_0[tempPos] = (val_0 + array_0[ARRAY_SIZE - 1] + array_0[ARRAY_SIZE - 2] + array_0[ARRAY_SIZE - 3])/3; +// array_1[tempPos] = (val_1 + array_1[ARRAY_SIZE - 1] + array_1[ARRAY_SIZE - 2] + array_1[ARRAY_SIZE - 3])/3; +// array_2[tempPos] = (val_2 + array_2[ARRAY_SIZE - 1] + array_2[ARRAY_SIZE - 2] + array_2[ARRAY_SIZE - 3])/3; + array_0[tempPos] = val_0; + array_1[tempPos] = val_1; + array_2[tempPos] = val_2; // calcurate the differenciation. if(tempPos == ARRAY_SIZE - 1){ @@ -215,15 +218,14 @@ isAutoActuation = true; } } - } - //else{ -// if((diff_0 > THRESHOLD) || (diff_1 > THRESHOLD) || (diff_2 > THRESHOLD)){ -// if((diff_0 < 3000) || (diff_1 < 3000) || (diff_2 < 3000)){ -// pc.printf("detected"); -// isAutoActuation = true; -// } -// } -// } + }else{ + if((diff_0 > THRESHOLD) || (diff_1 > THRESHOLD) || (diff_2 > THRESHOLD)){ + if((diff_0 < 3000) || (diff_1 < 3000) || (diff_2 < 3000)){ + pc.printf("detected"); + isAutoActuation = true; + } + } + } } int main() {