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 11:30f57addb79f, committed 2019-05-29
- Comitter:
- MarlonQ
- Date:
- Wed May 29 15:44:04 2019 +0000
- Parent:
- 10:92350e68d5ee
- Commit message:
- Final segundo corte;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 23 15:35:23 2019 +0000
+++ b/main.cpp Wed May 29 15:44:04 2019 +0000
@@ -57,7 +57,7 @@
/* ||Definicion de Puertos || */
Serial command(USBTX, USBRX);
// S0, S1, S2, S3, OUT
- scolor_TCS3200 scolor( PA_9, PC_7, PB_6, PA_7, PA_6 ) ;
+ scolor_TCS3200 scolor( PA_9, PC_7, PB_6, PA_4, PB_3) ; // PA_9, PC_7, PB_6, PA_7, PA_6
DigitalOut stepper_step ( PB_4 ) ;
DigitalOut steppeer_dir ( PB_5 ) ;
DigitalOut stepper_step2 ( PB_10 ) ;
@@ -65,14 +65,15 @@
AnalogIn analog_value0 ( A0 ) ;
AnalogIn analog_value1 ( A1 ) ;
PwmOut mybuzzer( PB_9 ) ;
-
+ Ticker tk1;
/* ||Definicion de Puertos || */
- uint32_t VELOCITY = 400 ; // Tiempo en micro segundos
+ uint32_t VELOCITY = 2500 ; // Tiempo en micro segundos
int16_t Lectura [ 2 ] = {} ;
double In [ 1 ] = {} ;
// definición de las funciones
+
void setup_uart ();
void leer_datos ();
void leer_color ();
@@ -81,6 +82,7 @@
int main() {
setup_uart();
+ tk1.attach( &leer_color, 0.1 );
while(1){
leer_datos();
@@ -139,11 +141,6 @@
if ( frqblue >= 5.0 and frqblue <= 29.0 ) {
- printf ( "tiende a rojo \n" );
- mybuzzer.period_us(DO);
- mybuzzer.write (0.8);
- wait (5);
- mybuzzer.write (0);
sel_color = 1;
}
@@ -158,11 +155,6 @@
if ( frqblue >= 10.0 and frqblue <= 26.0 ) {
- printf ( "tiende a verde \n" );
- mybuzzer.period_us(RE);
- mybuzzer.write (0.5);
- wait (5);
- mybuzzer.write (0);
sel_color = 2;
}
@@ -177,11 +169,6 @@
if ( frqred >= 5.0 and frqred <= 20.0 ) {
- printf ( "tiende a azul \n" );
- mybuzzer.period_us (MI);
- mybuzzer.write (1);
- wait (5);
- mybuzzer.write (0);
sel_color = 3;
}
@@ -195,12 +182,7 @@
if( frqgreen >= 20.0 and frqgreen <= 40.0) {
if ( frqred >= 20.0 and frqred <= 50.0 ) {
-
- printf ( "tiende a amarillo \n" );
- mybuzzer.period_us (FA);
- mybuzzer.write (0.6);
- wait (5);
- mybuzzer.write( 0);
+
sel_color = 4;
}
@@ -213,18 +195,13 @@
switch ( sel_color ) {
case 0 :
-
- //int32_t enviar5 = RESPUESTA5 ;
- //char txt5 [6] ;
- //printf ( txt5 , "%02X" , enviar5 );
- printf ( " FF00 \n " );
+ printf ( "FE01 \n" );
+
break ;
case 1 :
- //int32_t enviar1 = RESPUESTA1 ;
- //char txt1 [6] ;
printf ( "FE01 \n" );
sel_color = 0;
@@ -268,11 +245,11 @@
switch ( _Comando ){
// Acciones que ejerce el robot
- case 0 :
+ /*case 0 :
leer_color() ;
- break ;
+ break ;*/
case 1 :