No Description
Fork of mbed-os-example-mbed5-blinky by
main.cpp
- Committer:
- dabraham
- Date:
- 2017-08-29
- Revision:
- 41:bbb75c2a83a9
- Parent:
- 29:0b58d21e87d6
File content as of revision 41:bbb75c2a83a9:
#include "mbed.h"
//DigitalOut myled(LED1);
AnalogIn battery(A0);
//DigitalOut battery_warning(p24);
Serial pc(USBTX, USBRX);
int main() {
pc.baud(9600);
const float BAT_MUL = 10.26;
float sample;
while(1) {
sample = battery.read();
pc.printf("VBat: %4.3f, ADC: %4.3f, Vadc: %4.3f\r\n", sample*BAT_MUL, sample, sample*3.3);
/*if(sample*BAT_MUL < 6.4)
battery_warning = 0;
else
battery_warning = 1;*/
wait(5);
}
}
