![]() |
Re: arduino victor 884 and a cim
Quote:
just wired it up and copied in the code and it works as it is programmed for, tankdrive, im going to see about modifying it a bit for arcade, ill post results soon |
Re: arduino victor 884 and a cim
so i have worked through it and i think i have AN answer, but definatly not THE answer. I see a benefit to tankdrive, this deadzone is going to make turning horrendous
#include <Servo.h> Servo LeftMotor; //not really a servo! Servo RightMotor; //not really a servo! int JoyRL = A0; //value of Y axis on left joystick int JoyFB = A1; //value of Y asis on RIght joystick int FBval = 90; // variable to store the read FBvalue int RLval = 90; // variable to store the read RLvalue void setup() { LeftMotor.attach(9); RightMotor.attach(10); Serial.begin(9600); } void loop() { FBval = analogRead(JoyFB); FBval = map(FBval, 0, 1023, 0, 180)+10; //joystick miscalibration brought me here RLval = analogRead(JoyRL); RLval = map(RLval, 0, 1023, 180, 0); delay(100); analogRead(FBval); Serial.println(FBval); if(FBval < 85 || FBval > 95) { //Deadband forward(); } else if(RLval < 85 || RLval > 95) { //Deadband side(); }else{ RightMotor.write(90); LeftMotor.write(90); } } void forward() { RightMotor.write(FBval); LeftMotor.write(FBval); } void side() { RightMotor.write(RLval); LeftMotor.write(RLval); } now my jerry rigged motor inclusive wiring system just fell apart for the like millionth time so i cant know for sure, but what i saw on the victor is that it drops out a lot unless the joystick is in the middle, if the light is blinking up can i forget about seeing movement in the cim? if so i can almost guarentee that the problem is in the if/then/else statements im using, any suggestions on how to make it so those work together rather than against eachother? |
| All times are GMT -5. The time now is 06:15. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi