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.
Diff: main.cpp
- Revision:
- 1:5650b51c59f7
- Parent:
- 0:af114e34a5ae
diff -r af114e34a5ae -r 5650b51c59f7 main.cpp
--- a/main.cpp Wed Nov 14 21:49:17 2018 +0000
+++ b/main.cpp Tue Nov 20 01:43:26 2018 +0000
@@ -250,33 +250,67 @@
mpasos[1]= mbuff[0][3];
int cant=0;
emisor.printf("pasos %d ",mpasos[1]);
-while(cant<mpasos[1])
+switch(mpasos[0])
{
- for (int aa=0;aa<4;aa++)
- {
- mbuff[0][1]=2;
- mbuff[0][2]=aa+1;
- mbuff[0][3]=3;
- comando_2();
- //wait_ms(200);
- mbuff[0][1]=2;
- mbuff[0][2]=aa+1;
- mbuff[0][3]=2;
- comando_2();
- //wait_ms(200);
- }
- //wait_ms(100);
- for (int bb=0;bb<4;bb++)
- {
- mbuff[0][1]=2;
- mbuff[0][2]=bb+1;
- mbuff[0][3]=4;
- comando_2();
- }
- //wait_ms(200);
- cant++;
+ case 1:
+
+ while(cant<mpasos[1])
+ {
+ for (int aa=0;aa<4;aa++)
+ {
+ mbuff[0][1]=2;
+ mbuff[0][2]=aa+1;
+ mbuff[0][3]=3;
+ comando_2();
+ //wait_ms(200);
+ mbuff[0][1]=2;
+ mbuff[0][2]=aa+1;
+ mbuff[0][3]=2;
+ comando_2();
+ //wait_ms(200);
+ }
+ //wait_ms(100);
+ for (int bb=0;bb<4;bb++)
+ {
+ mbuff[0][1]=2;
+ mbuff[0][2]=bb+1;
+ mbuff[0][3]=4;
+ comando_2();
+ }
+ //wait_ms(200);
+ cant++;
+ }
+ break;
+ case 2:
+
+ while(cant<mpasos[1])
+ {
+ for (int zz=0;zz<4;zz++)
+ {
+ mbuff[0][1]=2;
+ mbuff[0][2]=zz+1;
+ mbuff[0][3]=4;
+ comando_2();
+ //wait_ms(200);
+ mbuff[0][1]=2;
+ mbuff[0][2]=zz+1;
+ mbuff[0][3]=2;
+ comando_2();
+ //wait_ms(200);
+ }
+ //wait_ms(100);
+ for (int vv=0;vv<4;vv++)
+ {
+ mbuff[0][1]=2;
+ mbuff[0][2]=vv+1;
+ mbuff[0][3]=3;
+ comando_2();
+ }
+ //wait_ms(200);
+ cant++;
+ }
+ break;
}
-
}
void sensor_color()
@@ -407,6 +441,13 @@
mbuff[0][3]=1;
paso();
}
+ else if (JX.read()*1000<400)
+ {emisor.printf("atras\n");
+ mbuff[0][1]=3;
+ mbuff[0][2]=2;
+ mbuff[0][3]=1;
+ paso();
+ }
else
{emisor.printf("Quieta\n");}
wait(0.5);