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.
adc-pc.cpp@1:82052538b6d6, 2016-10-09 (annotated)
- Committer:
- mfauzi
- Date:
- Sun Oct 09 08:39:05 2016 +0000
- Revision:
- 1:82052538b6d6
- Parent:
- 0:d288ab854d2c
ADC to Serial Port
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mfauzi | 0:d288ab854d2c | 1 | #include "mbed.h" |
| mfauzi | 0:d288ab854d2c | 2 | |
| mfauzi | 0:d288ab854d2c | 3 | Serial pc(USBTX, USBRX); |
| mfauzi | 0:d288ab854d2c | 4 | AnalogIn pot1(p19); |
| mfauzi | 0:d288ab854d2c | 5 | |
| mfauzi | 0:d288ab854d2c | 6 | int main() |
| mfauzi | 0:d288ab854d2c | 7 | { |
| mfauzi | 0:d288ab854d2c | 8 | pc.printf("Voltage Measurement"); |
| mfauzi | 0:d288ab854d2c | 9 | |
| mfauzi | 0:d288ab854d2c | 10 | while(true) { // this is the third thread |
| mfauzi | 1:82052538b6d6 | 11 | //pc.printf("Voltage : %3.3f V \n",pot1.read()*3.3); |
| mfauzi | 1:82052538b6d6 | 12 | pc.printf("%3.3f \n",pot1.read()*3.3); |
| mfauzi | 1:82052538b6d6 | 13 | wait(0.1); |
| mfauzi | 0:d288ab854d2c | 14 | } |
| mfauzi | 0:d288ab854d2c | 15 | } |