Hi,everyone
I'm trying to get data from sonar which is connected to "TELEM2" port of pixhawk by serial communication. However, my sorce code doesn't work and I can't see data which is sent by sonar.
My settings are
hardware: pixhawk(it connect to computer by USB)
sonar: MB7060-300 (MaxBotix, it connect to "TELEM2" port of pixhawk)
software: Misson planner
My sorce code are
User code cpp
#ifdef USERHOOK_MEDIUMLOOP
void Copter::userhook_MediumLoop()
{
static char incoming[10];
static uint8_t index=0;
static uint8_t value_index=0;
uint8_t data;
int16_t numc;
numc = sensor_port->available()
data = sensor_port->read();
hal.console->printf("data= %c",data);
...
}
...
}
And I rewrite "UserVariables.h".
I refer to this code : http://diydrones.com/forum/topics/pixhawk-custom-sensor-integration
When I tried it, many garbled messages appear in the terminal of mission planner. I attach the screenshot of this. I don't know why these garbled message appears.
Anyway, I want to see the data from sonar. Please give me some advise!
Thanks
Replies