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 // Divided Voltage ... Mechatronics example 00002 // 00003 // 2017.10.05 ... Y.Kuroda 00004 // 00005 #include "mbed.h" 00006 00007 DigitalOut myled(LED1); 00008 AnalogIn a0(A0); 00009 00010 const float vcc = 3.3; // Vcc voltage 00011 const float r1 = 10; // R1 [k-ohm] 00012 const float r2 = 30; // R2 [] 00013 00014 int main() { 00015 while(1) { 00016 myled = !myled; // LED is toggled 00017 00018 float vo = a0.read()*vcc; // Vo (analog voltage) 00019 float vp = r2/(r1+r2) * vo; 00020 printf("Analog %7.1f [v]\n", vp); 00021 } 00022 }
Generated on Tue Jul 12 2022 21:50:25 by
1.7.2