ROME2 Robot Firmware

Committer:
boro
Date:
Tue Mar 09 13:10:40 2021 +0000
Revision:
3:6fe17b8a6d62
Parent:
0:4beb2ea291ec
SDBlockDevice added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
boro 0:4beb2ea291ec 1 /*
boro 0:4beb2ea291ec 2 * IRSensor.h
boro 0:4beb2ea291ec 3 * Copyright (c) 2018, ZHAW
boro 0:4beb2ea291ec 4 * All rights reserved.
boro 0:4beb2ea291ec 5 */
boro 0:4beb2ea291ec 6
boro 0:4beb2ea291ec 7 #ifndef IR_SENSOR_H_
boro 0:4beb2ea291ec 8 #define IR_SENSOR_H_
boro 0:4beb2ea291ec 9
boro 0:4beb2ea291ec 10 #include <cstdlib>
boro 0:4beb2ea291ec 11 #include <mbed.h>
boro 0:4beb2ea291ec 12
boro 0:4beb2ea291ec 13 /**
boro 0:4beb2ea291ec 14 * This is a device driver class to read the distance measured with a Sharp IR sensor.
boro 0:4beb2ea291ec 15 */
boro 0:4beb2ea291ec 16 class IRSensor {
boro 0:4beb2ea291ec 17
boro 0:4beb2ea291ec 18 public:
boro 0:4beb2ea291ec 19
boro 0:4beb2ea291ec 20 IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number);
boro 0:4beb2ea291ec 21 virtual ~IRSensor();
boro 0:4beb2ea291ec 22 float read();
boro 0:4beb2ea291ec 23 operator float();
boro 0:4beb2ea291ec 24
boro 0:4beb2ea291ec 25 private:
boro 0:4beb2ea291ec 26
boro 0:4beb2ea291ec 27 AnalogIn& distance;
boro 0:4beb2ea291ec 28 DigitalOut& bit0;
boro 0:4beb2ea291ec 29 DigitalOut& bit1;
boro 0:4beb2ea291ec 30 DigitalOut& bit2;
boro 0:4beb2ea291ec 31
boro 0:4beb2ea291ec 32 int number;
boro 0:4beb2ea291ec 33 };
boro 0:4beb2ea291ec 34
boro 0:4beb2ea291ec 35 #endif /* IR_SENSOR_H_ */
boro 0:4beb2ea291ec 36
boro 0:4beb2ea291ec 37
boro 0:4beb2ea291ec 38