robot code for summer school
Dependencies: PM2_Libary Eigen
Fork of PM2_Example_Summer_School by
IRSensor.h@49:7da71f479dac, 2022-05-25 (annotated)
- Committer:
- seas726
- Date:
- Wed May 25 11:36:19 2022 +0200
- Revision:
- 49:7da71f479dac
speed control new files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
seas726 | 49:7da71f479dac | 1 | /* |
seas726 | 49:7da71f479dac | 2 | * IRSensor.h |
seas726 | 49:7da71f479dac | 3 | * Copyright (c) 2022, ZHAW |
seas726 | 49:7da71f479dac | 4 | * All rights reserved. |
seas726 | 49:7da71f479dac | 5 | */ |
seas726 | 49:7da71f479dac | 6 | |
seas726 | 49:7da71f479dac | 7 | #ifndef IR_SENSOR_H_ |
seas726 | 49:7da71f479dac | 8 | #define IR_SENSOR_H_ |
seas726 | 49:7da71f479dac | 9 | |
seas726 | 49:7da71f479dac | 10 | #include <cstdlib> |
seas726 | 49:7da71f479dac | 11 | #include <mbed.h> |
seas726 | 49:7da71f479dac | 12 | |
seas726 | 49:7da71f479dac | 13 | /** |
seas726 | 49:7da71f479dac | 14 | * This class implements a driver to read the distance sensors |
seas726 | 49:7da71f479dac | 15 | * of the ROME2 mobile robot. |
seas726 | 49:7da71f479dac | 16 | */ |
seas726 | 49:7da71f479dac | 17 | class IRSensor { |
seas726 | 49:7da71f479dac | 18 | |
seas726 | 49:7da71f479dac | 19 | public: |
seas726 | 49:7da71f479dac | 20 | |
seas726 | 49:7da71f479dac | 21 | IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number); |
seas726 | 49:7da71f479dac | 22 | virtual ~IRSensor(); |
seas726 | 49:7da71f479dac | 23 | float read(); |
seas726 | 49:7da71f479dac | 24 | //operator float(); |
seas726 | 49:7da71f479dac | 25 | |
seas726 | 49:7da71f479dac | 26 | private: |
seas726 | 49:7da71f479dac | 27 | |
seas726 | 49:7da71f479dac | 28 | AnalogIn& distance; |
seas726 | 49:7da71f479dac | 29 | DigitalOut& bit0; |
seas726 | 49:7da71f479dac | 30 | DigitalOut& bit1; |
seas726 | 49:7da71f479dac | 31 | DigitalOut& bit2; |
seas726 | 49:7da71f479dac | 32 | int number; |
seas726 | 49:7da71f479dac | 33 | }; |
seas726 | 49:7da71f479dac | 34 | |
seas726 | 49:7da71f479dac | 35 | #endif /* IR_SENSOR_H_ */ |