TeamSurface / Mbed 2 deprecated ROME_P3

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IRSensor.h Source File

IRSensor.h

00001 /*
00002  * IRSensor.h
00003  * Copyright (c) 2018, ZHAW
00004  * All rights reserved.
00005  */
00006 
00007 #ifndef IR_SENSOR_H_
00008 #define IR_SENSOR_H_
00009 
00010 #include <cstdlib>
00011 #include <mbed.h>
00012 
00013 /**
00014  * This is a device driver class to read the distance measured with a Sharp IR sensor.
00015  */
00016 class IRSensor {
00017     
00018     public:
00019         
00020                     IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number);
00021         virtual     ~IRSensor();
00022         float       read();
00023                     operator float();
00024         
00025     private:
00026         
00027         AnalogIn&       distance;
00028         DigitalOut&     bit0;
00029         DigitalOut&     bit1;
00030         DigitalOut&     bit2;
00031         
00032         int             number;
00033 };
00034 
00035 #endif /* IR_SENSOR_H_ */
00036 
00037