Buenas, soy nuevo en esto, estoy haciendo un trabajo de domótica y ahora mismo estoy haciendo una casa domótica con arduino, he llegado a tal punto que no se que hacer.
Os cuento, estoy controlando el arduino con app inventor, todo bien, enciendo leds, alarmas...
Pero cuando voy a controlar el garaje(gira sus 90 grados y todo bien), al encender una led, el garaje se mueve unos grados, como si detectase una señal o algo asi.
En el código del app inventor tengo send1bytenumber-90 grados para mover el servo y luego en el código de arduino tengo esto:
Por si les sirve de pista, cada vez que le doy a cualquier otro botón, el servo se mueve hasta el grado 50 aprox.
#include <SoftwareSerial.h> // TX RX software library for bluetooth
#include <Servo.h> // servo library
Servo myservo; // servo name
int bluetoothTx = 0; //
int bluetoothRx = 1; //
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
myservo.attach(13); //
Serial.begin(9600);
bluetooth.begin(9600);
}
void loop()
{
//Read from bluetooth and write to usb serial
if(bluetooth.available()> 0 ) // receive number from bluetooth
{
int servopos = bluetooth.read(); // save the received number to servopos
Serial.println(servopos); // serial print servopos current number received from bluetooth
myservo.write(servopos); // roate the servo the angle received from the android app
}
}
Que puedo hacer??Donde esta el error?Ayuda, es mi trabajo y tengo prisa, gracias de antemano!