Test capteur distant IR

Dependencies:   mbed

Fork of GP2Y0A710K0F_HelloWold by Christian Dupaty

Files at this revision

API Documentation at this revision

Comitter:
cdupaty
Date:
Sat Apr 30 17:04:19 2016 +0000
Parent:
2:6d058686efbf
Commit message:
test? et mis ? jour pour BTSSN

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6d058686efbf -r 70d33938ad46 main.cpp
--- 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 {