GROVE - 水分センサ サンプルプログラム

Dependencies:   mbed

Revision:
1:19779dd61a09
Parent:
0:94d8bb4e5fc1
--- a/main.cpp	Fri Nov 29 07:44:28 2013 +0000
+++ b/main.cpp	Sat Nov 30 01:55:48 2013 +0000
@@ -1,5 +1,7 @@
 #include "mbed.h"
 
+#define GAIN    10.0
+
 BusOut myleds(LED1, LED2, LED3, LED4);
 AnalogIn MoistureSensor(p15);
 
@@ -8,6 +10,8 @@
         float value = MoistureSensor;
         int ledbit = 0x00;
         
+        value *= GAIN;
+        
         if( value > 0.8 ) {
             ledbit = 0x0F;
         }
@@ -23,6 +27,8 @@
         else {
             ledbit = 0x00;
         }
+        
+        myleds = ledbit;
         printf("Value = %f\r\n",value);
         wait(0.2);
     }