Conteo en una banda transportadora

Dependencies:   mbed TCS3200 Pulse SeeedShieldBot BluetoothSerial

Files at this revision

API Documentation at this revision

Comitter:
diego_27
Date:
Thu Nov 11 10:01:21 2021 +0000
Commit message:
Proyecto Banda Transportadora

Changed in this revision

BluetoothSerial.lib Show annotated file Show diff for this revision Revisions of this file
PROYECTO.cpp Show annotated file Show diff for this revision Revisions of this file
Pulse.lib Show annotated file Show diff for this revision Revisions of this file
SeeedShieldBot.lib Show annotated file Show diff for this revision Revisions of this file
TCS3200.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r af774eabe2b7 BluetoothSerial.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluetoothSerial.lib	Thu Nov 11 10:01:21 2021 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/yihui/code/BluetoothSerial/#f56002898ee8
diff -r 000000000000 -r af774eabe2b7 PROYECTO.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PROYECTO.cpp	Thu Nov 11 10:01:21 2021 +0000
@@ -0,0 +1,77 @@
+#include "mbed.h"
+#include "Pulse.h"              //Libreria PulseIn                        
+Serial bt(PA_9,PA_10);         //Comunicacion con el modulo HC-06                 
+DigitalIn signal(PC_7);        //Señal del sensor de obstaculo         
+DigitalOut lamp(PB_3);        //Lampara
+DigitalOut s0(PB_6);                
+DigitalOut s1(PA_7);                    //Pines para el Sensor de color TCS230
+DigitalOut s2(PA_6);
+DigitalOut s3(PA_5); 
+DigitalOut pinMotorA(PC_10);                 //Declaracion de pins del motor reductor
+DigitalOut pinMotorB(PC_12);                   
+PulseInOut sensorSalida(PB_9);          //Salida del Sensor de color
+
+int main(){
+    bt.baud(9600);
+    int conteo=0;
+    int Rojo = 0;
+    int Verde = 0;                    
+    int Azul = 0;
+    pinMotorA=0;                    //motor prendido al inicio
+    pinMotorB=1;
+    lamp=0;
+    s0=1;                          //20% Freq del sensor
+    s1=0;
+    
+    for(;;){
+    //Sensor de Color
+    s2=0;                                   //ROJO
+    s3=0;
+    wait(.1);
+    Rojo = sensorSalida.read_low_us();
+    wait(.1);
+    
+    s2=1;                                   //Verde
+    s3=1;
+    wait(.1);
+    Verde = sensorSalida.read_low_us();
+    wait(.1);
+    
+    s2=0;                                   //Azul
+    s3=1;
+    wait(.1);
+    Azul = sensorSalida.read_low_us();
+    wait(.1);
+    
+    if (Rojo < 35 && Verde > 100 && Azul < 82)  bt.printf(" . *** ROJO ***");
+    if (Rojo > 105 && Verde > 110 && Azul >83 ) bt.printf(" . *** NEGRO ***");
+    if (Rojo > 20 && Verde < 28 && Azul < 27)   bt.printf(" . *** VERDE ***");
+    //Sensor de Objetos 
+    float valor = signal.read();  
+     valor = signal.read();
+    if(valor==0){
+        conteo++; 
+        while(signal.read()==0){                           //  while Para evitar que siga tomando valores (antirebote de señal)
+            wait(.1); 
+            
+            }  
+            bt.printf("%d",conteo);
+             }
+        
+    
+    if(conteo>=10){
+        bt.printf("*El proceso de conteo ha terminado*");
+        lamp=1;
+        wait(4.5);
+        pinMotorA=0;                    //motor apagado y el rele se activa la lampara prendida al terminar el proceso
+        pinMotorB=0;
+        conteo=0;
+        }else if(conteo==0){
+            lamp=0;
+            pinMotorA=0;                    //motor prendido 
+            pinMotorB=1;
+            }
+    
+    }
+    
+    }
\ No newline at end of file
diff -r 000000000000 -r af774eabe2b7 Pulse.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Pulse.lib	Thu Nov 11 10:01:21 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/NickRyder/code/Pulse/#fb79a4637a64
diff -r 000000000000 -r af774eabe2b7 SeeedShieldBot.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SeeedShieldBot.lib	Thu Nov 11 10:01:21 2021 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/components/code/SeeedShieldBot/#9fd1722259a1
diff -r 000000000000 -r af774eabe2b7 TCS3200.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TCS3200.lib	Thu Nov 11 10:01:21 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/wingblank/code/TCS3200/#9edf5a7e29e6
diff -r 000000000000 -r af774eabe2b7 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 11 10:01:21 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file