P2 halbfertig

Fork of Library by St Knz

Committer:
kueenste
Date:
Fri Mar 09 15:29:36 2018 +0000
Revision:
0:bb408887ab78
P2_unfertig;

Who changed what in which revision?

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