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
00001 #include "mbed.h" 00002 00003 DigitalOut myled(LED1); 00004 AnalogIn battery(p19); 00005 DigitalOut battery_warning(p24); 00006 Serial pc(USBTX, USBRX); 00007 00008 int main() { 00009 pc.baud(9600); 00010 const float BAT_MUL = 10.26; 00011 float sample; 00012 00013 while(1) { 00014 sample = battery.read(); 00015 pc.printf("VBat: %4.3f, ADC: %4.3f, Vadc: %4.3f\r\n", sample*BAT_MUL, sample, sample*3.3); 00016 if(sample*BAT_MUL < 6.4) 00017 battery_warning = 0; 00018 else 00019 battery_warning = 1; 00020 wait(1); 00021 } 00022 }
Generated on Wed Jul 13 2022 04:21:12 by
1.7.2