Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   arduino victor 884 and a cim (http://www.chiefdelphi.com/forums/showthread.php?t=114934)

Crawler 15-03-2013 21:59

Re: arduino victor 884 and a cim
 
Quote:

Originally Posted by tsaksa (Post 1248480)
The original post here requests information on controlling a CIM with a Spike, not a proportional motor controller. If that is still the case, then you do not want to output PWM signals at all. In fact, you do not even want to wire the cable the same way as if it was a PWM output. What you will need is two digital outputs, one connected to each of the two non-ground pins of a three pin PWM cable.

Tom

Finally found time to work on this again, on the contrary I am using a victor, sorry if i said spike somewhere.
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

Crawler 16-03-2013 03:25

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