Galera bom dia!
Eu me chamo Johnny e estou com um projeto de uma cadeira de rodas.
Minha intenção é ajudar o filho de um amigo que tem paralisia infantil , mas manuseia uma cadeira muito bem!
A cadeira trabalha com os seguintes componentes:
1 Joystick (PS2) , 1 Arduino uno , 2 Ponte H e 2 motores DC.
O projeto já está quase pronto ( inclusive já testei ) , mas noto um grande ruido nos motores quando cambo para os lados e ela não responte muito bem.
Estou usando essa programação:
const int PinoPotenciometroX = 0;
const int PinoPotenciometroY = 1;
const int motorDV = 5;
const int motorDR = 6;
const int motorEV = 10;
const int motorER = 11;
int ValorPotX = 0;
int pwmX = 0;
int ValorPotY = 0;
int pwmY = 0;
void setup() {
pinMode(motorDV, OUTPUT);
pinMode(motorDR, OUTPUT);
pinMode(motorEV, OUTPUT);
pinMode(motorER, OUTPUT);
}
void loop() {
ValorPotX = analogRead(PinoPotenciometroX);
pwmX = map(ValorPotX, 0, 1023, -255, 255);
ValorPotY = analogRead(PinoPotenciometroY);
pwmY = map(ValorPotY, 0, 1023, -255, 255);
if (490<ValorPotY<534 && 490<ValorPotX<534 ){
analogWrite(motorEV, LOW);
analogWrite(motorDV, LOW);
analogWrite(motorER, LOW);
analogWrite(motorDR, LOW);
}
if (ValorPotY>=534 && 490<ValorPotX<534 ){
analogWrite(motorEV, pwmY);
analogWrite(motorDV, pwmY);
analogWrite(motorER, LOW);
analogWrite(motorDR, LOW);
}
if (ValorPotY<=490 && 490<ValorPotX<534 ){
analogWrite(motorEV, LOW);
analogWrite(motorDV, LOW);
analogWrite(motorER, -pwmY);
analogWrite(motorDR, -pwmY);
}
if (490<ValorPotY<534 && ValorPotX>=524 ){
analogWrite(motorEV, pwmX);
analogWrite(motorDV, LOW);
analogWrite(motorER, LOW);
analogWrite(motorDR, pwmX);
}
if (490<ValorPotY<534 && ValorPotX<=490 ){
analogWrite(motorEV, LOW);
analogWrite(motorDV, -pwmX);
analogWrite(motorER, -pwmX);
analogWrite(motorDR, LOW);
}
if (ValorPotY>=534 && ValorPotX>=524 ){
analogWrite(motorEV, pwmY+pwmX);
analogWrite(motorDV, pwmY);
analogWrite(motorER, LOW);
analogWrite(motorDR, LOW);
}
if (ValorPotY<=490 && ValorPotX>=534 ){
analogWrite(motorEV, LOW);
analogWrite(motorDV, LOW);
analogWrite(motorER, -pwmY+pwmX);
analogWrite(motorDR, -pwmY);
}
if (ValorPotY<=490 && ValorPotX<=490 ){
analogWrite(motorEV, LOW);
Vcs podem me ajudar?
Tags:
Ola Johnny estou desenvolvendo um projeto semelhante ao seu, mas estou com muita dificuldade na parte de programação do joystick e da ponte H bts7960, você conseguiu desenvolver a programação?? e controlar a velocidade dos motores?
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por