Tags:
Sem o código não tem como saber, pois o princípio é extremamente simples.
O controle é analógico, faz-se a leitura através de 2 tipos de potenciômetros e um botão digital.
O problema pode estar no analógico, mas se nem lê no serial monitor, então é muito provável que o erro esteja no código.
O código com o Arduino:
#include <Servo.h>
Servo tilt, pan; // create servo object to control a servo
int joyX = A0; // analog pin used to connect the X - axis of Joystick
int joyY = A1; // analog pin used to connect the Y - axis of Joystick
int x, y; // variables to read the values from the analog pins
void setup()
{
tilt.attach(9); // attaches the tilt servo on pin 9 to the servo object
pan.attach(10); // attaches the pan servo on pin 10 to the servo object
}
void loop()
{
x = joyX; // reads the value of the Joystick's X - axis (value between 0 and 1023)
y = joyY; // reads the value of the Joystick's Y - axis (value between 0 and 1023)
x = map(analogRead(joyX), 0, 1023, 900, 2100); // scale it to use with the servo b/w 900 usec to 2100 usec
y = map(analogRead(joyY), 0, 1023, 900, 2100);
tilt.write(x); // sets the servo position according to the scaled value
pan.write(y);
delay(15); // waits for the servos to get there
}
Ola, bom dia.
Agradeço atenção.
Fiz a leitura com serial Monitor, mas o mesmo sem mexer fica nos 128.
E quando faz-se movimentos pula muito, ex; 128 para 0 ou 255.
Imagino ser do controle.Estou pensando em comprar um controle original esta por volta de 50,00.
Os demais itens do controle esta ok, junto com a biblioteca.
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por