Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
void control(void){rprintf("starting");delay_ms(200);int se=a2dConvert8bit(0);se=sharp_IR_interpret_GP2D12(se);rprintf("sensor results: %d \n",se);delay_ms(2000);}
define se a2dConvert8bit(0)void control(void){rprintf("starting");delay_ms(200);sensor=sharp_IR_interpret_GP2D12(se);rprintf("sensor results: %d \n", sensor);delay_ms(2000);}
You can't define a function as a value to an int variable. You are also overwriting your own define. Do this:Code: [Select]define se a2dConvert8bit(0)void control(void){rprintf("starting");delay_ms(200);sensor=sharp_IR_interpret_GP2D12(se);rprintf("sensor results: %d \n", sensor);delay_ms(2000);}
everything works fine when a servo is connected to one of the said ports.
chelmi, thanks for calling me out on this . . . it was too early when I replied, brain wasn't turned on yet . . . I was thinking of the WebbotLib API where you put a port number in that SharpIR function and not a sensor value. I've been using WebbotLib a lot lately and got mixed up. Ignore my previous post!bsamuels, what do you mean by 'gets hung up'?Quoteeverything works fine when a servo is connected to one of the said ports.Whats your battery voltage, and how many Sharp IRs are you using?
void control(void){rprintf("starting");delay_ms(200);rprintf("delay successful");int se=a2dConvert8bit(0);rprintf("a2d conversion successful");se=sharp_IR_interpret_GP2D12(se);rprintf("sensor results: %d \n",se);delay_ms(2000);}
What actual voltage is your battery at, as measured with a voltage meter?Did you modify any other Axon code, such as the ADC initialization stuff?Also for this:int se=a2dConvert8bit(0);you should declare se as an int outside of your loop.
void control(void){rprintf("starting");delay_ms(2000);}
I'm pretty sure something is wrong with your sensor. Are you sure you got the wiring on it right?The reason I ask is some people mistake the wiring on a sharp IR as ground/power/signal, but its actually power/ground/signal . . .Check the sensor AND the Axon with a multimeter while its plugged in, too.
As for using the multimeter while it is trying to run, where do you want the current to be tested? on the battery, sensor pins, or what?
I had a similar problem a long time ago, and never found a real reason.It had something to do with the timer. Try commenting out delay_ms and commenting out all the timer_init in Axon.c . For delays use delay_us(delay in microseconds), because that doesn't use a timer.
But on an off note, any reason why my sensor results are scaling inversely with distance from the sensor? If I have an object right in front (10cm) away from its aperture, I get a result like 90, and if I move an object about 70cm away, I get results like 20-30.Might this be a wiring problem?
Quote from: bsamuels on October 09, 2009, 08:39:51 PMBut on an off note, any reason why my sensor results are scaling inversely with distance from the sensor? If I have an object right in front (10cm) away from its aperture, I get a result like 90, and if I move an object about 70cm away, I get results like 20-30.Might this be a wiring problem?Nope, thats normal.Are you using the latest Axon code version?