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.
Fork of mbed-os-example-mbed5-blinky by
main.cpp@41:bbb75c2a83a9, 2017-08-29 (annotated)
- Committer:
- dabraham
- Date:
- Tue Aug 29 00:25:26 2017 +0000
- Revision:
- 41:bbb75c2a83a9
- Parent:
- 29:0b58d21e87d6
Blinky
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Jonathan Austin |
0:2757d7abb7d9 | 1 | #include "mbed.h" |
| dabraham | 41:bbb75c2a83a9 | 2 | |
| dabraham | 41:bbb75c2a83a9 | 3 | //DigitalOut myled(LED1); |
| dabraham | 41:bbb75c2a83a9 | 4 | AnalogIn battery(A0); |
| dabraham | 41:bbb75c2a83a9 | 5 | //DigitalOut battery_warning(p24); |
| dabraham | 41:bbb75c2a83a9 | 6 | Serial pc(USBTX, USBRX); |
| dabraham | 41:bbb75c2a83a9 | 7 | |
| Jonathan Austin |
0:2757d7abb7d9 | 8 | int main() { |
| dabraham | 41:bbb75c2a83a9 | 9 | pc.baud(9600); |
| dabraham | 41:bbb75c2a83a9 | 10 | const float BAT_MUL = 10.26; |
| dabraham | 41:bbb75c2a83a9 | 11 | float sample; |
| dabraham | 41:bbb75c2a83a9 | 12 | |
| dabraham | 41:bbb75c2a83a9 | 13 | while(1) { |
| dabraham | 41:bbb75c2a83a9 | 14 | sample = battery.read(); |
| dabraham | 41:bbb75c2a83a9 | 15 | pc.printf("VBat: %4.3f, ADC: %4.3f, Vadc: %4.3f\r\n", sample*BAT_MUL, sample, sample*3.3); |
| dabraham | 41:bbb75c2a83a9 | 16 | /*if(sample*BAT_MUL < 6.4) |
| dabraham | 41:bbb75c2a83a9 | 17 | battery_warning = 0; |
| dabraham | 41:bbb75c2a83a9 | 18 | else |
| dabraham | 41:bbb75c2a83a9 | 19 | battery_warning = 1;*/ |
| dabraham | 41:bbb75c2a83a9 | 20 | wait(5); |
| Jonathan Austin |
0:2757d7abb7d9 | 21 | } |
| dabraham | 41:bbb75c2a83a9 | 22 | } |
