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.
Dependencies: mbed
IRSensor.h@0:d8d297847268, 2020-03-25 (annotated)
- Committer:
- koenithi
- Date:
- Wed Mar 25 13:26:46 2020 +0000
- Revision:
- 0:d8d297847268
Rome2_p3
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| koenithi | 0:d8d297847268 | 1 | /* |
| koenithi | 0:d8d297847268 | 2 | * IRSensor.h |
| koenithi | 0:d8d297847268 | 3 | * Copyright (c) 2020, ZHAW |
| koenithi | 0:d8d297847268 | 4 | * All rights reserved. |
| koenithi | 0:d8d297847268 | 5 | */ |
| koenithi | 0:d8d297847268 | 6 | |
| koenithi | 0:d8d297847268 | 7 | #ifndef IR_SENSOR_H_ |
| koenithi | 0:d8d297847268 | 8 | #define IR_SENSOR_H_ |
| koenithi | 0:d8d297847268 | 9 | |
| koenithi | 0:d8d297847268 | 10 | #include <cstdlib> |
| koenithi | 0:d8d297847268 | 11 | #include <mbed.h> |
| koenithi | 0:d8d297847268 | 12 | |
| koenithi | 0:d8d297847268 | 13 | /** |
| koenithi | 0:d8d297847268 | 14 | * This class implements a driver to read the distance sensors |
| koenithi | 0:d8d297847268 | 15 | * of the ROME2 mobile robot. |
| koenithi | 0:d8d297847268 | 16 | */ |
| koenithi | 0:d8d297847268 | 17 | class IRSensor { |
| koenithi | 0:d8d297847268 | 18 | |
| koenithi | 0:d8d297847268 | 19 | public: |
| koenithi | 0:d8d297847268 | 20 | |
| koenithi | 0:d8d297847268 | 21 | IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number); |
| koenithi | 0:d8d297847268 | 22 | virtual ~IRSensor(); |
| koenithi | 0:d8d297847268 | 23 | float read(); |
| koenithi | 0:d8d297847268 | 24 | operator float(); |
| koenithi | 0:d8d297847268 | 25 | |
| koenithi | 0:d8d297847268 | 26 | private: |
| koenithi | 0:d8d297847268 | 27 | |
| koenithi | 0:d8d297847268 | 28 | AnalogIn& distance; |
| koenithi | 0:d8d297847268 | 29 | DigitalOut& bit0; |
| koenithi | 0:d8d297847268 | 30 | DigitalOut& bit1; |
| koenithi | 0:d8d297847268 | 31 | DigitalOut& bit2; |
| koenithi | 0:d8d297847268 | 32 | int number; |
| koenithi | 0:d8d297847268 | 33 | }; |
| koenithi | 0:d8d297847268 | 34 | |
| koenithi | 0:d8d297847268 | 35 | #endif /* IR_SENSOR_H_ */ |
| koenithi | 0:d8d297847268 | 36 |