Gruppe 3
/
PES
Roboter
IRSensor.h@0:306a2438de17, 2017-03-21 (annotated)
- Committer:
- itslinear
- Date:
- Tue Mar 21 12:42:01 2017 +0000
- Revision:
- 0:306a2438de17
hoiii
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
itslinear | 0:306a2438de17 | 1 | #ifndef IR_SENSOR_H_ |
itslinear | 0:306a2438de17 | 2 | #define IR_SENSOR_H_ |
itslinear | 0:306a2438de17 | 3 | |
itslinear | 0:306a2438de17 | 4 | #include <cstdlib> |
itslinear | 0:306a2438de17 | 5 | #include <mbed.h> |
itslinear | 0:306a2438de17 | 6 | |
itslinear | 0:306a2438de17 | 7 | /** |
itslinear | 0:306a2438de17 | 8 | * This is a device driver class to read the distance measured with a Sharp IR sensor. |
itslinear | 0:306a2438de17 | 9 | */ |
itslinear | 0:306a2438de17 | 10 | class IRSensor |
itslinear | 0:306a2438de17 | 11 | { |
itslinear | 0:306a2438de17 | 12 | |
itslinear | 0:306a2438de17 | 13 | public: |
itslinear | 0:306a2438de17 | 14 | |
itslinear | 0:306a2438de17 | 15 | IRSensor(AnalogIn* distance, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number); |
itslinear | 0:306a2438de17 | 16 | IRSensor(); |
itslinear | 0:306a2438de17 | 17 | |
itslinear | 0:306a2438de17 | 18 | void init(AnalogIn* distance, DigitalOut* bit0, DigitalOut* bit1, DigitalOut* bit2, int number); |
itslinear | 0:306a2438de17 | 19 | virtual ~IRSensor(); |
itslinear | 0:306a2438de17 | 20 | float read(); |
itslinear | 0:306a2438de17 | 21 | |
itslinear | 0:306a2438de17 | 22 | operator float(); |
itslinear | 0:306a2438de17 | 23 | |
itslinear | 0:306a2438de17 | 24 | private: |
itslinear | 0:306a2438de17 | 25 | |
itslinear | 0:306a2438de17 | 26 | AnalogIn* distance; |
itslinear | 0:306a2438de17 | 27 | DigitalOut* bit0; |
itslinear | 0:306a2438de17 | 28 | DigitalOut* bit1; |
itslinear | 0:306a2438de17 | 29 | DigitalOut* bit2; |
itslinear | 0:306a2438de17 | 30 | |
itslinear | 0:306a2438de17 | 31 | int number; |
itslinear | 0:306a2438de17 | 32 | }; |
itslinear | 0:306a2438de17 | 33 | |
itslinear | 0:306a2438de17 | 34 | #endif /* IR_SENSOR_H_ */ |