mbedbidos
/
recoge_manzanas_final
final, faltan ganas
Revision 7:5f1c8385cf8e, committed 2018-11-22
- Comitter:
- jiuk
- Date:
- Thu Nov 22 10:38:28 2018 +0000
- Parent:
- 6:4c9e8118c303
- Commit message:
- final final este si es...;
Changed in this revision
recoge_manzanas.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/recoge_manzanas.cpp Thu Nov 22 09:57:49 2018 +0000 +++ b/recoge_manzanas.cpp Thu Nov 22 10:38:28 2018 +0000 @@ -33,7 +33,58 @@ bool _boton=0; void blink(); void boton(); -void sendSPI(); +void sendSPI(uint8_t,uint8_t); + + +//-------------------------------------------------- +//-------------------CARA_FELIZ------------------------ +//-------------------------------------------------- +void cara_feliz() +{ + sendSPI(0x02,0b01100110); + wait(0.2); + sendSPI(0x03,0b01100110); + wait(0.2); + sendSPI(0x06,0b01000010); + wait(0.2); + sendSPI(0x07,0b00111100); + wait(0.2); + for(int i=0;i<4;i++) + { + sendSPI(0x06,0x00); + sendSPI(0x07,0b00111100); + wait(0.2); + sendSPI(0x07,0b00111100); + wait(0.2); + sendSPI(0x06,0b01000010); + wait(0.2); + } +} + +//-------------------------------------------------- +//-------------------CARA_TRISTE------------------------ +//-------------------------------------------------- +void cara_triste() +{ + sendSPI(0x02,0b01100110); + wait(0.2); + sendSPI(0x03,0b01100110); + wait(0.2); + sendSPI(0x06,0b00111100); + wait(0.2); + sendSPI(0x07,0b01000010); + wait(0.2); + for(int i=0;i<4;i++) + { + sendSPI(0x07,0x00); + sendSPI(0x06,0b00111100); + wait(0.2); + sendSPI(0x06,0b00111100); + wait(0.2); + sendSPI(0x07,0b01000010); + wait(0.2); + } +} //-------------------------------------------------- //-------------------TICKER------------------------ @@ -42,9 +93,9 @@ { blink(); boton(); - if (command.readable()) + if (com_tar.readable()) { - //sendSPI(0x05,0xff); + cara_triste(); command.printf("Button pressed %b\n", _boton); } }; @@ -339,7 +390,7 @@ { com_tar.putc(1); command.printf("Enviado"); - //mostrar_carita_feliz(); + cara_feliz(); } x=1; }