usefulsensors / person_sensor_docs

Documentation for the Person Sensor
54 stars 11 forks source link

Single shot in standby mode #11

Open hbredin opened 1 year ago

hbredin commented 1 year ago

I am trying to trigger a single shot detection in standby mode.

Documentation says:

Address Name Default Description
0x01 Mode 0x01 (continuous) Mode. See mode table below.
0x03 Single shot 0x00 Trigger a single-shot inference. Only works if the sensor is in standby mode.

I therefore

  1. set the sensor to standby mode by writing 0x00 to address 0x01 (this seems to work)
  2. trigger a single shot by writing 0x01 to address 0x03

Then, what shoud I do to read the result?

Reading the data works fine in continuous mode but does not return anything (empty list of faces) after triggering the single shot in standby mode.

hbredin commented 1 year ago

I think I understand what happens.

I did not wait long enough for the single shot to be completed before reading the detection results. Adding a bit of delay before reading the data does work as expected.

For others impatient like me, here is a (the?) solution:

  1. set the sensor to standby mode by writing 0x00 to address 0x01 (this seems to work)
  2. trigger a single shot by writing 0x01 to address 0x03
  3. wait a second
  4. read the result