facuclop facuclop
/
02_serial_cheto_facuclop
LCD Hello World Program
Fork of 04LCD_Hello_Word by
Revision 2:fae7972e0801, committed 2014-08-05
- Comitter:
- facuclop
- Date:
- Tue Aug 05 23:33:36 2014 +0000
- Parent:
- 1:99f6b4191e94
- Commit message:
- serial communication whit digital out for kl46z by facuclop
Changed in this revision
diff -r 99f6b4191e94 -r fae7972e0801 TextLCD.lib --- a/TextLCD.lib Tue May 27 07:30:09 2014 +0000 +++ b/TextLCD.lib Tue Aug 05 23:33:36 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Eduvance/code/TextLCD/#befde34054fb +http://mbed.org/users/facuclop/code/TextLCD/#c9add656c693
diff -r 99f6b4191e94 -r fae7972e0801 main.cpp --- a/main.cpp Tue May 27 07:30:09 2014 +0000 +++ b/main.cpp Tue Aug 05 23:33:36 2014 +0000 @@ -1,16 +1,534 @@ -#include "mbed.h" //header file -#include "LCD.h" +#include "mbed.h" +#include "string.h" +//#include "conio.h" + +DigitalOut da0(D0); +DigitalOut da1(D1); +DigitalOut da2(D2); +DigitalOut da3(D3); +DigitalOut da4(D4); +DigitalOut da5(D5); +DigitalOut da6(D6); +DigitalOut da7(D7); +DigitalOut da8(D8); +DigitalOut da9(D9); +DigitalOut da10(D10); +DigitalOut da11(D11); +DigitalOut da12(D12); +DigitalOut da13(D13); +DigitalOut da14(D14); +DigitalOut da15(D15); +DigitalOut da16(PTB18); +DigitalOut da17(PTB19); +DigitalOut da18(PTC0); +DigitalOut da19(PTC4); +DigitalOut da20(PTC6); +DigitalOut da21(PTC7); +DigitalOut da22(PTC10); +DigitalOut da23(PTC11); +DigitalOut da24(PTC13); +DigitalOut da25(PTC16); +DigitalOut da26(PTA7); +DigitalOut da27(PTA6); +DigitalOut da28(PTA14); +DigitalOut da29(PTA15); +DigitalOut da30(PTA16); +DigitalOut da31(PTA17); +DigitalOut da32(PTB9); +DigitalOut da33(PTE30); +DigitalOut da34(PTB20); +DigitalOut da35(PTE23); +DigitalOut da36(PTE22); +DigitalOut da37(PTE21); +DigitalOut da38(PTE20); +DigitalOut da39(PTE2); +DigitalOut da40(PTE3); +DigitalOut da41(PTE6); +DigitalOut da42(PTE16); +DigitalOut da43(PTE17); +DigitalOut da44(PTE18); +DigitalOut da45(PTE19); +DigitalOut da46(PTE31); +DigitalOut da47(PTC1); +DigitalOut da48(PTC2); +DigitalOut da49(PTB3); +DigitalOut da50(PTB2); +DigitalOut da51(PTB1); +DigitalOut da52(PTB0); +DigitalOut da53(PTA20); + + +Serial pc(USBTX, USBRX); +char* leer (char* texto) + +{char car[10]=""; do {car[0]=pc.getc(); + strcat(texto,car);} + while (car[0] != 'z'); //mientras car sea diferente a z suma las palabras (es como un enter el z) + return texto;} // fo = c y z es el x +char c[6]=""; +char enter[6]=""; +float pepe = 0.01; -DigitalOut myled(LED1); -int main() { -while(1) { -LCD_init(); //initialising LCD - display_to_LCD(0x48); // “H‟ - display_to_LCD(0x45); // “E‟ - display_to_LCD(0x4C); // “L‟ - display_to_LCD(0x4C); // “L‟ -display_to_LCD(0x4F); // “O‟ - wait(1); - -} -} +int main() +{ + pc.printf("online"); + while(1) + { + strcpy(c,leer(enter)); + + if( strcmp(c,"fo0zz")==0){da0 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb0zz")==0){da0 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo1zz")==0){da1 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb1zz")==0){da1 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo2zz")==0){da2 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb2zz")==0){da2 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo3zz")==0){da3 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb3zz")==0){da3 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo4zz")==0){da4 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb4zz")==0){da4 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo5zz")==0){da5 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb5zz")==0){da5 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo6zz")==0){da6 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb6zz")==0){da6 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo7zz")==0){da7 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb7zz")==0){da7 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo8zz")==0){da8 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb8zz")==0){da8 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo9zz")==0){da9 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb9zz")==0){da9 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo10zz")==0){da10 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb10zz")==0){da10 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo11zz")==0){da11 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb11zz")==0){da11 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo12zz")==0){da12 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb12zz")==0){da12 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo13zz")==0){da13 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb13zz")==0){da13 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo14zz")==0){da14 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb14zz")==0){da14 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo15zz")==0){da15 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb15zz")==0){da15 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo16zz")==0){da16 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb16zz")==0){da16 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo17zz")==0){da17 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb17zz")==0){da17 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo18zz")==0){da18 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb18zz")==0){da18 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo19zz")==0){da19 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb19zz")==0){da19 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo20zz")==0){da20 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb20zz")==0){da20 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo21zz")==0){da21 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb21zz")==0){da21 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo22zz")==0){da22 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb22zz")==0){da22 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo23zz")==0){da23 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb23zz")==0){da23 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo24zz")==0){da24 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb24zz")==0){da24 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo25zz")==0){da25 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb25zz")==0){da25 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo26zz")==0){da26 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb26zz")==0){da26 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo27zz")==0){da27 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb27zz")==0){da27 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo28zz")==0){da28 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb28zz")==0){da28 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo29zz")==0){da29 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb29zz")==0){da29 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo30zz")==0){da30 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb30zz")==0){da30 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo31zz")==0){da31 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb31zz")==0){da31 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo32zz")==0){da32 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb32zz")==0){da32 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo33zz")==0){da33 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb33zz")==0){da33 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo34zz")==0){da34 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb34zz")==0){da34 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo35zz")==0){da35 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb35zz")==0){da35 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo36zz")==0){da36 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb36zz")==0){da36 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo37zz")==0){da37 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb37zz")==0){da37 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo38zz")==0){da38 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb38zz")==0){da38 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo39zz")==0){da39 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb39zz")==0){da39 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo40zz")==0){da40 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb40zz")==0){da40 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo41zz")==0){da41 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb41zz")==0){da41 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo42zz")==0){da42 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb42zz")==0){da42 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo43zz")==0){da43 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb43zz")==0){da43 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo44zz")==0){da44 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb44zz")==0){da44 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo45zz")==0){da45 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb45zz")==0){da45 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo46zz")==0){da46 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb46zz")==0){da46 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo47zz")==0){da47 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb47zz")==0){da47 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo48zz")==0){da48 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb48zz")==0){da48 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo49zz")==0){da49 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb49zz")==0){da49 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo50zz")==0){da50 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb50zz")==0){da50 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo51zz")==0){da51 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb51zz")==0){da51 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo52zz")==0){da52 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb52zz")==0){da52 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + if( strcmp(c,"fo53zz")==0){da53 = 0;strcpy(c,""); strcpy(enter,"");} //prende + if( strcmp(c,"fb53zz")==0){da53 = 1;strcpy(c,""); strcpy(enter,"");} //apaga + + +if( strcmp(c,"apazz")==0){ + da0 = 0; + da1 = 0; + da2= 0; + da3= 0; + da4= 0; + da5= 0; + da6= 0; + da7= 0; + da8= 0; + da9= 0; + da10= 0; + da11= 0; + da12= 0; + da13= 0; + da14= 0; + da15= 0; + da16= 0; + da17= 0; + da18= 0; + da19= 0; + da20= 0; + da21= 0; + da22= 0; + da23= 0; + da24= 0; + da25= 0; + da26= 0; + da27= 0; + da28= 0; + da29= 0; + da30= 0; + da31= 0; + da32= 0; + da33= 0; + da34= 0; + da35= 0; + da36= 0; + da37= 0; + da38= 0; + da39= 0; + da40= 0; + da41= 0; + da42= 0; + da43= 0; + da44= 0; + da45= 0; + da46= 0; + da47= 0; + da48= 0; + da49= 0; + da50= 0; + da51= 0; + da52= 0; + da53= 0; + + strcpy(c,""); strcpy(enter,"");} //apaga todo + + if( strcmp(c,"prezz")==0){ + da0 = 1; + da1 = 1; + da2= 1; + da3= 1; + da4= 1; + da5= 1; + da6= 1; + da7= 1; + da8= 1; + da9= 1; + da10= 1; + da11= 1; + da12= 1; + da13= 1; + da14= 1; + da15= 1; + da16= 1; + da17= 1; + da18= 1; + da19= 1; + da20= 1; + da21= 1; + da22= 1; + da23= 1; + da24= 1; + da25= 1; + da26= 1; + da27= 1; + da28= 1; + da29= 1; + da30= 1; + da31= 1; + da32= 1; + da33= 1; + da34= 1; + da35= 1; + da36= 1; + da37= 1; + da38= 1; + da39= 1; + da40= 1; + da41= 1; + da42= 1; + da43= 1; + da44= 1; + da45= 1; + da46= 1; + da47= 1; + da48= 1; + da49= 1; + da50= 1; + da51= 1; + da52= 1; + da53= 1; + + strcpy(c,""); strcpy(enter,"");} //prende + + if( strcmp(c,"juezz")==0){ + da0 = 1; + wait (pepe); + da1 = 1; + wait (pepe); + da2= 1; + wait (pepe); + da3= 1; + wait (pepe); + da4= 1; + wait (pepe); + da5= 1; + wait (pepe); + da6= 1; + wait (pepe); + da7= 1; + wait (pepe); + da8= 1; + wait (pepe); + da9= 1; + wait (pepe); + da10= 1; + wait (pepe); + da11= 1; + wait (pepe); + da12= 1; + wait (pepe); + da13= 1; + wait (pepe); + da14= 1; + wait (pepe); + da15= 1; + wait (pepe); + da16= 1; + wait (pepe); + da17= 1; + wait (pepe); + da18= 1; + wait (pepe); + da19= 1; + wait (pepe); + da20= 1; + wait (pepe); + da21= 1; + wait (pepe); + da22= 1; + wait (pepe); + da23= 1; + wait (pepe); + da24= 1; + wait (pepe); + da25= 1; + wait (pepe); + da26= 1; + wait (pepe); + da27= 1; + wait (pepe); + da28= 1; + wait (pepe); + da29= 1; + wait (pepe); + da30= 1; + wait (pepe); + da31= 1; + wait (pepe); + da32= 1; + wait (pepe); + da33= 1; + wait (pepe); + da34= 1; + wait (pepe); + da35= 1; + wait (pepe); + da36= 1; + wait (pepe); + da37= 1; + wait (pepe); + da38= 1; + wait (pepe); + da39= 1; + wait (pepe); + da40= 1; + wait (pepe); + da41= 1; + wait (pepe); + da42= 1; + wait (pepe); + da43= 1; + wait (pepe); + da44= 1; + wait (pepe); + da45= 1; + wait (pepe); + da46= 1; + wait (pepe); + da47= 1; + wait (pepe); + da48= 1; + wait (pepe); + da49= 1; + wait (pepe); + da50= 1; + wait (pepe); + da51= 1; + wait (pepe); + da52= 1; + wait (pepe); + da53= 1; + wait (pepe); + + // ff + + da0 = 0; + wait (pepe); + da1 = 0; + wait (pepe); + da2= 0; + wait (pepe); + da3= 0; + wait (pepe); + da4= 0; + wait (pepe); + da5= 0; + wait (pepe); + da6= 0; + wait (pepe); + da7= 0; + wait (pepe); + da8= 0; + wait (pepe); + da9= 0; + wait (pepe); + da10= 0; + wait (pepe); + da11= 0; + wait (pepe); + da12= 0; + wait (pepe); + da13= 0; + wait (pepe); + da14= 0; + wait (pepe); + da15= 0; + wait (pepe); + da16= 0; + wait (pepe); + da17= 0; + wait (pepe); + da18= 0; + wait (pepe); + da19= 0; + wait (pepe); + da20= 0; + wait (pepe); + da21= 0; + wait (pepe); + da22= 0; + wait (pepe); + da23= 0; + wait (pepe); + da24= 0; + wait (pepe); + da25= 0; + wait (pepe); + da26= 0; + wait (pepe); + da27= 0; + wait (pepe); + da28= 0; + wait (pepe); + da29= 0; + wait (pepe); + da30= 0; + wait (pepe); + da31= 0; + wait (pepe); + da32= 0; + wait (pepe); + da33= 0; + wait (pepe); + da34= 0; + wait (pepe); + da35= 0; + wait (pepe); + da36= 0; + wait (pepe); + da37= 0; + wait (pepe); + da38= 0; + wait (pepe); + da39= 0; + wait (pepe); + da40= 0; + wait (pepe); + da41= 0; + wait (pepe); + da42= 0; + wait (pepe); + da43= 0; + wait (pepe); + da44= 0; + wait (pepe); + da45= 0; + wait (pepe); + da46= 0; + wait (pepe); + da47= 0; + wait (pepe); + da48= 0; + wait (pepe); + da49= 0; + wait (pepe); + da50= 0; + wait (pepe); + da51= 0; + wait (pepe); + da52= 0; + wait (pepe); + da53= 0; + wait (pepe); + + + + strcpy(c,""); strcpy(enter,"");} //juego de luces prendidas secuencialmente + + pc.printf(c); + + +} +} \ No newline at end of file
diff -r 99f6b4191e94 -r fae7972e0801 mbed.bld --- a/mbed.bld Tue May 27 07:30:09 2014 +0000 +++ b/mbed.bld Tue Aug 05 23:33:36 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721 \ No newline at end of file