Test capteur distant IR

Dependencies:   mbed

Fork of GP2Y0A710K0F_HelloWold by Christian Dupaty

Revision:
3:70d33938ad46
Parent:
1:0490a15c76e4
--- a/main.cpp	Thu Mar 12 08:22:00 2015 +0000
+++ b/main.cpp	Sat Apr 30 17:04:19 2016 +0000
@@ -1,19 +1,19 @@
 #include "mbed.h"
  
-AnalogIn analog_value(A0);
+AnalogIn GP2Y0A710K0F(A0);
  
 DigitalOut led(LED1);
 
 int main() {
-    float meas;
+    float mes;
     
     printf("\nAnalogIn example\n");
     
     while(1) {
-        meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
-        meas = meas * 3300; // Change the value to be in the 0 to 3300 range
-        printf("measure = %.0f mV\n", meas);
-        if (meas > 2000) { // If the value is greater than 2V then switch the LED on
+        mes = GP2Y0A710K0F.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        mes = mes * 3300; // Change the value to be in the 0 to 3300 range
+        printf("mesure = %.0f mV\n\r", mes);
+        if (mes > 2000) { // If the value is greater than 2V then switch the LED on
           led = 1;
         }
         else {