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
Library/IRSensor.h@1:7bf9b6c007a1, 2018-03-23 (annotated)
- Committer:
- kueenste
- Date:
- Fri Mar 23 15:40:09 2018 +0000
- Revision:
- 1:7bf9b6c007a1
- Parent:
- 0:7cf5bf7e9486
schissdreck funktioniert so halbe
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kueenste | 0:7cf5bf7e9486 | 1 | /* |
| kueenste | 0:7cf5bf7e9486 | 2 | * IRSensor.h |
| kueenste | 0:7cf5bf7e9486 | 3 | * Copyright (c) 2018, ZHAW |
| kueenste | 0:7cf5bf7e9486 | 4 | * All rights reserved. |
| kueenste | 0:7cf5bf7e9486 | 5 | */ |
| kueenste | 0:7cf5bf7e9486 | 6 | |
| kueenste | 0:7cf5bf7e9486 | 7 | #ifndef IR_SENSOR_H_ |
| kueenste | 0:7cf5bf7e9486 | 8 | #define IR_SENSOR_H_ |
| kueenste | 0:7cf5bf7e9486 | 9 | |
| kueenste | 0:7cf5bf7e9486 | 10 | #include <cstdlib> |
| kueenste | 0:7cf5bf7e9486 | 11 | #include <mbed.h> |
| kueenste | 0:7cf5bf7e9486 | 12 | |
| kueenste | 0:7cf5bf7e9486 | 13 | /** |
| kueenste | 0:7cf5bf7e9486 | 14 | * This is a device driver class to read the distance measured with a Sharp IR sensor. |
| kueenste | 0:7cf5bf7e9486 | 15 | */ |
| kueenste | 0:7cf5bf7e9486 | 16 | class IRSensor { |
| kueenste | 0:7cf5bf7e9486 | 17 | |
| kueenste | 0:7cf5bf7e9486 | 18 | public: |
| kueenste | 0:7cf5bf7e9486 | 19 | |
| kueenste | 0:7cf5bf7e9486 | 20 | IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number); |
| kueenste | 0:7cf5bf7e9486 | 21 | virtual ~IRSensor(); |
| kueenste | 0:7cf5bf7e9486 | 22 | float read(); |
| kueenste | 0:7cf5bf7e9486 | 23 | operator float(); |
| kueenste | 0:7cf5bf7e9486 | 24 | |
| kueenste | 0:7cf5bf7e9486 | 25 | private: |
| kueenste | 0:7cf5bf7e9486 | 26 | |
| kueenste | 0:7cf5bf7e9486 | 27 | AnalogIn& distance; |
| kueenste | 0:7cf5bf7e9486 | 28 | DigitalOut& bit0; |
| kueenste | 0:7cf5bf7e9486 | 29 | DigitalOut& bit1; |
| kueenste | 0:7cf5bf7e9486 | 30 | DigitalOut& bit2; |
| kueenste | 0:7cf5bf7e9486 | 31 | |
| kueenste | 0:7cf5bf7e9486 | 32 | int number; |
| kueenste | 0:7cf5bf7e9486 | 33 | }; |
| kueenste | 0:7cf5bf7e9486 | 34 | |
| kueenste | 0:7cf5bf7e9486 | 35 | #endif /* IR_SENSOR_H_ */ |
| kueenste | 0:7cf5bf7e9486 | 36 | |
| kueenste | 0:7cf5bf7e9486 | 37 |