gugus

Dependencies:   mbed

Committer:
Brignall
Date:
Fri May 18 12:18:21 2018 +0000
Revision:
0:1a0321f1ffbc
lala;

Who changed what in which revision?

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