Gruppe 3 / Mbed 2 deprecated PES3

Dependencies:   Servo mbed pixy

Fork of PES1 by Gruppe 3

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IRSensor.h Source File

IRSensor.h

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