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