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.
Revision 6:4c9e8118c303, committed 2018-11-22
- Comitter:
- jiuk
- Date:
- Thu Nov 22 09:57:49 2018 +0000
- Parent:
- 5:f8ca9f670abe
- Commit message:
- con interrupci?n de serial
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:00:51 2018 +0000
+++ b/recoge_manzanas.cpp Thu Nov 22 09:57:49 2018 +0000
@@ -33,6 +33,7 @@
bool _boton=0;
void blink();
void boton();
+void sendSPI();
//--------------------------------------------------
//-------------------TICKER------------------------
@@ -41,6 +42,11 @@
{
blink();
boton();
+ if (command.readable())
+ {
+ //sendSPI(0x05,0xff);
+ command.printf("Button pressed %b\n", _boton);
+ }
};
//--------------------------------------------------
@@ -272,17 +278,17 @@
y=((int)(in2.read()*-650))+13;
acc[0]=x;
acc[1]=y;
- command.printf("Joystick: \t X= %d, \t Y= %d, \n", x,y);
+ //command.printf("Joystick: \t X= %d, \t Y= %d, \n", x,y);
}
else
{
Wire.getAccelero(_acc);
acc[0]=(int)_acc[0];
acc[1]=(int)_acc[1];
- command.printf("Accelerometer: \t X= %d, \t Y= %d, \n", acc[0],acc[1]);
+ //command.printf("Accelerometer: \t X= %d, \t Y= %d, \n", acc[0],acc[1]);
}
- command.printf("Velocidad %d \n", v);
+ //command.printf("Velocidad %d \n", v);
if(acc[0]>GIRO) //eje x derecha
{
if(acc[1]>G_DIAG) //eje y arriba
@@ -325,13 +331,15 @@
{
manzanas++;
sendSPI(fila,columna);
- for(int i=0;i<manzanas;i++)
+ int guarda_linea=columna+colum;
+ sendSPI(fila,guarda_linea);
+ generar_punto();
+ sendSPI(fil,colum);
+ if(manzanas==4)
{
- int guarda_linea=columna+colum;
- sendSPI(fila,guarda_linea);
- generar_punto();
- sendSPI(fil,colum);
- //com_tar.putc(x);
+ com_tar.putc(1);
+ command.printf("Enviado");
+ //mostrar_carita_feliz();
}
x=1;
}