mbed/ARM 活用事例 第5章 赤外線距離センサを使う mbedで初めてのマイコン開発 その6 センサを使ってみよう<2> 赤外線センサを使って赤外線距離計を製作するプログラムです。

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
sunifu
Date:
Tue Oct 04 13:22:41 2011 +0000
Parent:
0:635c06588089
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 635c06588089 -r 7de58ea468a1 main.cpp
--- a/main.cpp	Fri Feb 18 04:44:21 2011 +0000
+++ b/main.cpp	Tue Oct 04 13:22:41 2011 +0000
@@ -24,7 +24,7 @@
     data = (now +old)/2.0 ;
     lcd.locate(0,0) ;
     if (0.121 <= data && data <= 0.970){
-        float range = 26.663 * pow((data*3.3),-1.25);
+        float range = 25.33 * pow((data*3.3),-1.21);
         lcd.printf("Range: %4.1f[cm]",range) ;
         out = 0.5;
     }else{