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 #include "TextLCD.h" 00003 00004 TextLCD lcd(PTB2, PTB3, PTB10, PTB11, PTC11, PTC10, TextLCD::LCD16x2); // rs, e, d4-d7 00005 AnalogIn V(PTC2); 00006 Serial PC(USBTX, USBRX); 00007 DigitalOut LED(PTB22); 00008 00009 void Config_ptos(void); 00010 void Proceso(void); 00011 void Presentacion(void); 00012 void Lectura(void); 00013 00014 float Vr = 3.3, Df = 0.991; 00015 float Vd, Vo; 00016 00017 int main() 00018 { 00019 Config_ptos(); 00020 while(1) { 00021 Proceso(); 00022 } 00023 } 00024 00025 void Config_ptos(void) 00026 { 00027 PC.format(8, Serial::None, 1); 00028 PC.baud(9600); 00029 LED = 1; 00030 } 00031 00032 00033 void Proceso(void) 00034 { 00035 //if(PC.readable()) { 00036 if(PC.getc()=='A') { 00037 LED = 1; 00038 } 00039 00040 if(PC.getc()=='B') { 00041 LED = 0; 00042 } 00043 00044 //} 00045 00046 //if(PC.writeable()) { 00047 Vo = V.read(); 00048 Vd = Vr * Vo/ Df; 00049 00050 lcd.locate(0,0); 00051 lcd.printf("V = %f V", Vd); 00052 00053 PC.printf("V = %f V\n", Vd); 00054 PC.printf("\r\n"); 00055 00056 wait_ms(500); 00057 lcd.cls(); 00058 //} 00059 }
Generated on Fri Jul 22 2022 12:41:45 by
1.7.2