ver1
Dependencies: mbed
Revision 1:9d0c57c475ce, committed 2018-04-04
- Comitter:
- kurikuri
- Date:
- Wed Apr 04 06:12:54 2018 +0000
- Parent:
- 0:b40d3d1793b1
- Commit message:
- cm??;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b40d3d1793b1 -r 9d0c57c475ce main.cpp --- a/main.cpp Wed Apr 04 02:10:50 2018 +0000 +++ b/main.cpp Wed Apr 04 06:12:54 2018 +0000 @@ -6,8 +6,12 @@ int main() { while(1){ - distance = ain.read(); - pc.printf("Distance:%f\n\r",distance); + double x = 0; + for(int i=0;i<10;i++){ + distance = 53.444*pow(double(ain.read()),-1.736)/10; + x += distance; + } + pc.printf("Distance:%f\n\r",x/10); wait(0.5); } }