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
main.cpp@0:2ea0e4324c05, 2020-02-14 (annotated)
- Committer:
- louis_mynott
- Date:
- Fri Feb 14 15:33:46 2020 +0000
- Revision:
- 0:2ea0e4324c05
q;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| louis_mynott | 0:2ea0e4324c05 | 1 | #include "mbed.h" |
| louis_mynott | 0:2ea0e4324c05 | 2 | |
| louis_mynott | 0:2ea0e4324c05 | 3 | class Sensor { |
| louis_mynott | 0:2ea0e4324c05 | 4 | private: |
| louis_mynott | 0:2ea0e4324c05 | 5 | DigitalOut LED; |
| louis_mynott | 0:2ea0e4324c05 | 6 | AnalogIn sensor; |
| louis_mynott | 0:2ea0e4324c05 | 7 | public: |
| louis_mynott | 0:2ea0e4324c05 | 8 | Sensor(PinName ledPin, PinName sensorPin): LED(ledPin), sensor(sensorPin){}; |
| louis_mynott | 0:2ea0e4324c05 | 9 | void power(int state){ |
| louis_mynott | 0:2ea0e4324c05 | 10 | LED.write(state); |
| louis_mynott | 0:2ea0e4324c05 | 11 | } |
| louis_mynott | 0:2ea0e4324c05 | 12 | double read(){ |
| louis_mynott | 0:2ea0e4324c05 | 13 | return sensor.read(); |
| louis_mynott | 0:2ea0e4324c05 | 14 | } |
| louis_mynott | 0:2ea0e4324c05 | 15 | |
| louis_mynott | 0:2ea0e4324c05 | 16 | }; |
| louis_mynott | 0:2ea0e4324c05 | 17 | |
| louis_mynott | 0:2ea0e4324c05 | 18 | |
| louis_mynott | 0:2ea0e4324c05 | 19 | int main() { |
| louis_mynott | 0:2ea0e4324c05 | 20 | |
| louis_mynott | 0:2ea0e4324c05 | 21 | } |
| louis_mynott | 0:2ea0e4324c05 | 22 |