me dice en veces que no esta conectado, que revise conexion, y la pak que realice no me marca errores, que debo hacer?
y este codigo es que tengo para un brazo robotico
#include <SoftwareSerial.h> //libreria de TX Rx Seriak para bletooth
#include <Servo.h> //libreria para motores:
int bluetoothTx=0;//bluetooth Tx al pin 0
int bluetoothRx=1; // bluetooth Rx al pin 1
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
Servo ser_hor, ser_ver, ser_alt; //crear los objetos para los servos horizontal y vertical
int servopos_hor = 90; // posicion inicial del servo horizontal
int servopos_ver = 90; // posicion inicial del servo vertical
int servopos_alt = 90; //posicion inicial del servo altura
void setup() {
Serial.begin(9600);
bluetooth.begin(9600);
ser_hor.attach(3); //servo horizontal conectado al pin 3
ser_ver.attach(11); // servo vertical conectado al pin 11
ser_alt.attach(4); // servo vertical conectado al pin 11
}
void loop () {
if (bluetooth.available()>=2)
{
unsigned int servopos=bluetooth.read();
unsigned int servopos1=bluetooth.read();
unsigned int realservo=(servopos1*256)+servopos;
Serial.println(realservo);
if (realservo>= 1000 && realservo<1180){
int servo1=realservo;
servo1=map(servo1,1000,1180,0,180);
ser_hor.write(servo1);
Serial.println("ser_hor on");
delay (10);
}
if (realservo>= 2000 && realservo<2180){
int servo2=realservo;
servo2=map(servo2,2000,2180,0,180);
ser_ver.write(servo2);
Serial.println("ser_ver on");
delay (10);
}
if (realservo>= 3000 && realservo<3180){
int servo3=realservo;
servo3=map(servo3,3000,3180,0,180);
ser_alt.write(servo3);
Serial.println("ser_alt on");
delay (10);
}
}
}