Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Modulo Arduino Modulo Bluetooth
Modulo Arduino Modulo Bluetooth
PIN2 PIN Tx
PIN3 PIN Rx
GND GND
5VOLTZ 5VOLTZ
PUENTE H-O6
PIN5 PIN-N1
PIN6 PIN-N2
PIN9 PIN-N3
PIN10 PIN-N4
GND GND
// SOUL DANY.
#include <SoftwareSerial.h>
#include <Servo.h>
int bluetoothTx = 2;
int bluetoothRx = 3;
// MOTOR 1.
int Motor1A = 5;
int Motor1B = 6;
// MOTOR 2.
int Motor2A = 9;
bluetooth.begin(115200);
bluetooth.print("$$$");
delay(100);
bluetooth.println("U,9600,N");
bluetooth.begin(9600);
void loop()
if(bluetooth.available())
{
char toSend = (char)bluetooth.read();
if(toSend == 'S')
flag1 = 0;
flag2 = 0;
if (flag1 != 1)
flag1 = 1;
analogWrite( Motor1B, 0 );
analogWrite( Motor2B, 0 );
}
if(toSend == 'B' || toSend == 'H' || toSend == 'J')
if(flag1 != 2)
flag1 = 2;
analogWrite( Motor1A, 0 );
analogWrite( Motor2A, 0 );
if(flag2 != 1)
flag2 = 1;
analogWrite( Motor2A, 0 );
analogWrite( Motor1B, 0 );
else
if(flag2 != 2)
flag2 = 2;
analogWrite( Motor1A, 0 );
analogWrite( Motor2B, 0 );
else
if(flag2 != 3)
// SI TU SABES PARA QUE SIRVE ESTO DIME POR QUE SE LO PUSO UN AMIGO Y NI IDEA.
flag2 = 3;