Using Webbot Library, on Axon 1.... programming for sensor (Sharp GP2D12) not working...
#include "sys/axon.h"
#include "uart.h"
#include "rprintf.h"
#include "servos.h"
#include "a2d.h"
#include "Sensors/Distance/Sharp/GP2D12.h"
Sharp_GP2D12 sensor = MAKE_Sharp_GP2D12(8);
//
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
distanceInit(sensor);
distanceRead(sensor);
rprintf("%d \r\n",sensor);
return 0;
}
as output, i get "1216" repeatedly, regardless of the sensing distance. (same with %u instead of %d)
If I use the same rprintf with sensor.distance.cm then it repeatedly displays "0" !
I tried different things, couldn't figure out the problem...
It works fine with the old library, when I use (once sensor.c is included)
int range = sharp_IR_interpret_GP2D12(a2dConvert8bit(8));
rprintf("%d \r\n",range);
it displays the range in cm directly !...
Need help making it work in WebbotLib...
Thanks...