Prometheus / IRSensor
Committer:
ZHAW_Prometheus
Date:
Tue Feb 28 15:28:07 2017 +0000
Revision:
0:f4862c7fd394
0.1;

Who changed what in which revision?

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