参考下面代码进行测距,在物体较远>2M时,返回的状态不稳定 会返回DeviceRangeStatusInternal = 9 距离=8190mm和 DeviceRangeStatusInternal = 8,距离=20mm两种状态 请问有人遇到这种问题吗,谢谢 void test() { byte val1 = read_byte_data_at(VL53L0X_REG_IDENTIFICATION_REVISION_ID); Serial.print("Revision ID: "); Serial.println(val1); val1 = read_byte_data_at(VL53L0X_REG_IDENTIFICATION_MODEL_ID); Serial.print("Device ID: "); Serial.println(val1); val1 = read_byte_data_at(VL53L0X_REG_PRE_RANGE_CONFIG_VCSEL_PERIOD); Serial.print("PRE_RANGE_CONFIG_VCSEL_PERIOD="); Serial.println(val1); Serial.print(" decode: "); Serial.println(VL53L0X_decode_vcsel_period(val1)); val1 = read_byte_data_at(VL53L0X_REG_FINAL_RANGE_CONFIG_VCSEL_PERIOD); Serial.print("FINAL_RANGE_CONFIG_VCSEL_PERIOD="); Serial.println(val1); Serial.print(" decode: "); Serial.println(VL53L0X_decode_vcsel_period(val1)); write_byte_data_at(VL53L0X_REG_SYSRANGE_START, 0x01); byte val = 0; int cnt = 0; while (cnt < 100) { // 1 second waiting time max delay(10); val = read_byte_data_at(VL53L0X_REG_RESULT_RANGE_STATUS); if (val & 0x01) break; cnt++; } if (val & 0x01) Serial.println("ready"); else Serial.println("not ready"); read_block_data_at(0x14, 12); uint16_t acnt = makeuint16(gbuf[7], gbuf[6]); uint16_t scnt = makeuint16(gbuf[9], gbuf[8]); uint16_t dist = makeuint16(gbuf[11], gbuf[10]); byte DeviceRangeStatusInternal = ((gbuf[0] & 0x78) >> 3); Serial.print("ambient count: "); Serial.println(acnt); Serial.print("signal count: "); Serial.println(scnt); Serial.print("distance "); Serial.println(dist); Serial.print("status: "); Serial.println(DeviceRangeStatusInternal); } |
评分
查看全部评分
是的,VL53L0X测距sensor,物体距离特别远的时候,多次测距,会返回20mm和8190mm两种结果,个人理解是超出测距范围应该稳定的返回8190
这个是别的单片机的代码,不是STM32的
评分
查看全部评分
谢谢,您使用的时候,在距离大于2米的时候,会不会出现返回20mm呢?
评分
查看全部评分