Ok I was vague on the problems with the compass, so here is the problem-
I am using the IFI Dashboard to read the PWM output (0-255) but when I turn on the robot the value shots up to 60 (not exactly) then quickly goes back to 0 then repeats the process at a slower rate. Then about a minute in to the process it eventually stops at 28. Nothing affect the process, if I turn the compass or put it by the motors it stays the same.
This is the Aliases-
* Below are aliases for reading an analog voltage on the ANALOG INPUTS
* using the Get_Analog_Value() function.
*/
#define Temp_Guage ADC_CH0
#define Pressure_Guage ADC_CH1
#define rc_ana_in03 ADC_CH2
#define Compass ADC_CH3
#define rc_ana_in05 ADC_CH4
#define rc_ana_in06 ADC_CH5
#define rc_ana_in07 ADC_CH6
#define rc_ana_in08 ADC_CH7
#define rc_ana_in09 ADC_CH8
#define rc_ana_in10 ADC_CH9
#define rc_ana_in11 ADC_CH10
#define rc_ana_in12 ADC_CH11
#define rc_ana_in13 ADC_CH12
#define rc_ana_in14 ADC_CH13
#define rc_ana_in15 ADC_CH14
#define rc_ana_in16 ADC_CH15
#define SIXTEEN_ANALOG ADC_16ANA /* All analog */
This is how I call it-
pwm11 = Get_Analog_Value(Pressure_Guage)/4;
pwm12 = Get_Analog_Value(Temp_Guage)/4.023;
pwm13 = Get_Analog_Value(Compass)/4.023;
{
unsigned int temp;
temp = Get_Analog_Value(Compass);
temp *= 4023; //fraction version of
temp /= 1000; //your conversion factor - avoid floating point
pwm13 = (unsigned char)temp;
printf("%d", pwm13);
}
Thank you!
By the way, I am using the Devantech Magnetic Compass - CMPS03 on a ROV so there no other robots around and also the motors we are using are about a 1.5 feet away and are small. (Nothing like the big CIMs) The only things that could interfere is the Aluminum water proof housing, or the electronics beside the compass.
Heres a link to some Pictures if that could help you- (The compass is not in these pictures but is inside the Aluminum water proof housing)
http://picasaweb.google.com/KE7JLM/RobotAllan