Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
IRSensor.h@0:7ee4c6416e08, 2020-02-24 (annotated)
- Committer:
- oehlemar
- Date:
- Mon Feb 24 16:05:50 2020 +0000
- Revision:
- 0:7ee4c6416e08
ROME2 P1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oehlemar | 0:7ee4c6416e08 | 1 | /* |
oehlemar | 0:7ee4c6416e08 | 2 | * IRSensor.h |
oehlemar | 0:7ee4c6416e08 | 3 | * Copyright (c) 2020, ZHAW |
oehlemar | 0:7ee4c6416e08 | 4 | * All rights reserved. |
oehlemar | 0:7ee4c6416e08 | 5 | */ |
oehlemar | 0:7ee4c6416e08 | 6 | |
oehlemar | 0:7ee4c6416e08 | 7 | #ifndef IR_SENSOR_H_ |
oehlemar | 0:7ee4c6416e08 | 8 | #define IR_SENSOR_H_ |
oehlemar | 0:7ee4c6416e08 | 9 | |
oehlemar | 0:7ee4c6416e08 | 10 | #include <cstdlib> |
oehlemar | 0:7ee4c6416e08 | 11 | #include <mbed.h> |
oehlemar | 0:7ee4c6416e08 | 12 | |
oehlemar | 0:7ee4c6416e08 | 13 | /** |
oehlemar | 0:7ee4c6416e08 | 14 | * This class implements a driver to read the distance sensors |
oehlemar | 0:7ee4c6416e08 | 15 | * of the ROME2 mobile robot. |
oehlemar | 0:7ee4c6416e08 | 16 | */ |
oehlemar | 0:7ee4c6416e08 | 17 | class IRSensor { |
oehlemar | 0:7ee4c6416e08 | 18 | |
oehlemar | 0:7ee4c6416e08 | 19 | public: |
oehlemar | 0:7ee4c6416e08 | 20 | |
oehlemar | 0:7ee4c6416e08 | 21 | IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number); |
oehlemar | 0:7ee4c6416e08 | 22 | virtual ~IRSensor(); |
oehlemar | 0:7ee4c6416e08 | 23 | float read(); |
oehlemar | 0:7ee4c6416e08 | 24 | |
oehlemar | 0:7ee4c6416e08 | 25 | private: |
oehlemar | 0:7ee4c6416e08 | 26 | |
oehlemar | 0:7ee4c6416e08 | 27 | AnalogIn& distance; |
oehlemar | 0:7ee4c6416e08 | 28 | DigitalOut& bit0; |
oehlemar | 0:7ee4c6416e08 | 29 | DigitalOut& bit1; |
oehlemar | 0:7ee4c6416e08 | 30 | DigitalOut& bit2; |
oehlemar | 0:7ee4c6416e08 | 31 | int number; |
oehlemar | 0:7ee4c6416e08 | 32 | }; |
oehlemar | 0:7ee4c6416e08 | 33 | |
oehlemar | 0:7ee4c6416e08 | 34 | #endif /* IR_SENSOR_H_ */ |
oehlemar | 0:7ee4c6416e08 | 35 |