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.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 00004 DigitalOut Vcc(PA_0); 00005 AnalogIn aInn(PA_1); 00006 DigitalOut Gnd(PA_4); 00007 00008 00009 int main() 00010 { 00011 Vcc = 1; 00012 Gnd = 0; 00013 00014 float maxVoltage,minVoltage; 00015 00016 maxVoltage = minVoltage = aInn.read()*3.3f; 00017 00018 while(1) 00019 { 00020 float voltage; 00021 for(int i = 0; i < 1000; i++) 00022 { 00023 voltage += aInn.read()*3.3f; 00024 } 00025 00026 voltage = voltage/1000; 00027 00028 if(voltage < minVoltage) minVoltage = voltage; 00029 if(voltage > maxVoltage)maxVoltage = voltage; 00030 00031 printf("VoltIn: %.3f Max: %.3f Min: %.3f Diff: %.3f\r\n", voltage, maxVoltage, minVoltage, maxVoltage-minVoltage); 00032 00033 // printf("Voltage:\t%.3f \r\n", voltage); 00034 wait_ms(135); 00035 } 00036 00037 00038 }
Generated on Thu Jul 21 2022 02:53:36 by
