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: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
measurement/Potentiometer.h@123:311fa85af2b3, 2015-05-29 (annotated)
- Committer:
- xinlei
- Date:
- Fri May 29 12:05:01 2015 +0000
- Revision:
- 123:311fa85af2b3
- Parent:
- 100:dbcd3bc51758
- Child:
- 136:a52821cdb108
measurement: revert timing to use timer to avoid negative time after long run
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| xinlei | 100:dbcd3bc51758 | 1 | #ifndef POTENTIOMETER_H |
| xinlei | 100:dbcd3bc51758 | 2 | #define POTENTIOMETER_H |
| xinlei | 100:dbcd3bc51758 | 3 | #include "mbed.h" |
| xinlei | 100:dbcd3bc51758 | 4 | #include "AbstractReporter.h" |
| xinlei | 100:dbcd3bc51758 | 5 | |
| xinlei | 100:dbcd3bc51758 | 6 | |
| xinlei | 100:dbcd3bc51758 | 7 | class Potentiometer: public AbstractReporter |
| xinlei | 100:dbcd3bc51758 | 8 | { |
| xinlei | 100:dbcd3bc51758 | 9 | public: |
| xinlei | 123:311fa85af2b3 | 10 | Potentiometer(): timer() { |
| xinlei | 100:dbcd3bc51758 | 11 | oldValues[0] = 0; |
| xinlei | 100:dbcd3bc51758 | 12 | oldValues[1] = 0; |
| xinlei | 123:311fa85af2b3 | 13 | timer.start(); |
| xinlei | 100:dbcd3bc51758 | 14 | } |
| xinlei | 100:dbcd3bc51758 | 15 | virtual ~Potentiometer() {} |
| xinlei | 100:dbcd3bc51758 | 16 | virtual bool init() { return true; } |
| xinlei | 100:dbcd3bc51758 | 17 | virtual const char* name() const { return "Poti"; } |
| xinlei | 100:dbcd3bc51758 | 18 | virtual size_t read(char*, size_t, char*, size_t); |
| xinlei | 100:dbcd3bc51758 | 19 | private: |
| xinlei | 100:dbcd3bc51758 | 20 | float oldValues[2]; |
| xinlei | 123:311fa85af2b3 | 21 | Timer timer; |
| xinlei | 100:dbcd3bc51758 | 22 | }; |
| xinlei | 100:dbcd3bc51758 | 23 | |
| xinlei | 100:dbcd3bc51758 | 24 | #endif /* POTENTIOMETER_H */ |
