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.
main.cpp@3:083b8bb2bb8b, 2017-05-24 (annotated)
- Committer:
- alainpegatoquet
- Date:
- Wed May 24 12:26:14 2017 +0000
- Branch:
- Test_AnalogIn
- Revision:
- 3:083b8bb2bb8b
- Parent:
- 2:c4d361e4a860
- Child:
- 4:6a426b4967e5
AnalogIn input has been validated
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| alainpegatoquet | 0:b2a3eec02494 | 1 | #include "mbed.h" |
| alainpegatoquet | 3:083b8bb2bb8b | 2 | Serial pc(USBTX, USBRX); |
| alainpegatoquet | 0:b2a3eec02494 | 3 | |
| alainpegatoquet | 2:c4d361e4a860 | 4 | DigitalOut myled1(LED1); |
| alainpegatoquet | 3:083b8bb2bb8b | 5 | AnalogIn Ain(p20); // Analog input |
| alainpegatoquet | 0:b2a3eec02494 | 6 | |
| alainpegatoquet | 0:b2a3eec02494 | 7 | int main() { |
| alainpegatoquet | 3:083b8bb2bb8b | 8 | float ADCdata; |
| alainpegatoquet | 0:b2a3eec02494 | 9 | while(1) { |
| alainpegatoquet | 2:c4d361e4a860 | 10 | myled1 = 1; |
| alainpegatoquet | 1:82d0e5b4654c | 11 | wait(0.5); |
| alainpegatoquet | 2:c4d361e4a860 | 12 | myled1 = 0; |
| alainpegatoquet | 1:82d0e5b4654c | 13 | wait(1.0); |
| alainpegatoquet | 3:083b8bb2bb8b | 14 | ADCdata=Ain.read(); |
| alainpegatoquet | 3:083b8bb2bb8b | 15 | pc.printf("%f\t%fV \n\r",ADCdata, ADCdata*3.3); |
| alainpegatoquet | 3:083b8bb2bb8b | 16 | wait(0.5); |
| alainpegatoquet | 0:b2a3eec02494 | 17 | } |
| alainpegatoquet | 0:b2a3eec02494 | 18 | } |