openmv4和stm32位置没用变化,是待识别物体与openmv超过1m左右时,stm32接收到的数据没有继续变化,但是openmv上数据还是实时在变。
stm32程序
void USART2_IRQHandler(void) //串口2中断服务程序
{
static uint16_t rebuf[8]={0},i=0;
u8 j=0;
if( USART_GetITStatus(USART2,USART_IT_RXNE)!=RESET)
{
rebuf[i++]=USART_ReceiveData(USART2);
if(rebuf[0]!=0x2C)/
i=0;
if((i==2)&&(rebuf[1]!=0x12))/
i=0;
if(rebuf[i-1]==0x3C)
{
for(j =0;j<i;j++)
{
RxBuffer1[j] = rebuf[j];
}
i = 0;
}
USART_ClearFlag(USART2,USART_FLAG_RXNE);openmv程序
def sending_data(cx,cy):
data = ustruct.pack("<bbhhb",
0x2C,
0x12,
int(cx),
int(cy),
0x3C)
uart.write(data);好了问题已经解决了,是因为距离太远像素变低,我设置了一个像素的阈值