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 AnalogIn voltaje(PTB0); 00004 Serial jd(USBTX, USBRX); 00005 DigitalOut led(LED1); 00006 DigitalIn p(PTC5); 00007 DigitalOut m(PTC6); 00008 DigitalIn l(PTC3); 00009 DigitalOut h(PTC0); 00010 float v; 00011 int j=0; 00012 int t; 00013 int x=0; 00014 int main(){ 00015 while(1){ 00016 v=voltaje.read()*3.3; 00017 int t=(int)v;//cambiar de flotante a un entero 00018 00019 00020 if(l==1){ 00021 00022 j=1; 00023 led=0; 00024 m=1; 00025 wait(1); 00026 //wait(10); 00027 00028 00029 } 00030 00031 else{ 00032 led=1; 00033 m=0; 00034 j=0; 00035 //wait(2); 00036 } 00037 switch(j){ 00038 case 1: 00039 if(j==t){ 00040 m=0; 00041 led=1; 00042 jd.printf("azul\n"); 00043 wait(5); 00044 h=1; 00045 wait(5); 00046 h=0; 00047 00048 00049 } 00050 break;} 00051 00052 //aparte 00053 if(p==1){ 00054 00055 j=2; 00056 led=0; 00057 m=1; 00058 00059 } 00060 00061 else{ 00062 led=1; 00063 m=0; 00064 j=0;} 00065 00066 00067 switch(j){ 00068 case 2: 00069 if(j==t){ 00070 m=0; 00071 led=1; 00072 jd.printf("negro\n"); 00073 wait(5); 00074 m=1; 00075 wait(9); 00076 m=0; 00077 } 00078 break;} 00079 00080 00081 } 00082 }
Generated on Tue Jul 26 2022 00:33:52 by
1.7.2