Skip to content

Commit a417126

Browse files
authored
Merge pull request #20 from brtchip-tuannguyen/master
Add motion detect feature
2 parents 43b8f77 + 0f8dc4f commit a417126

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

adafruit_vc0706.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,23 @@ def read_picture_into(self, buf):
213213
buf[i] = self._buffer[i]
214214
return n
215215

216+
def motion_detected(self):
217+
"""Read the gesture detection result"""
218+
self._read_response(self._buffer, len(self._buffer))
219+
if not self._verify_response(_COMM_MOTION_DETECTED):
220+
return False
221+
return True
222+
223+
def get_motion_detect(self):
224+
"""Query the gesture detection status"""
225+
return self._run_command(_COMM_MOTION_STATUS, bytes([0x00]), 6)
226+
227+
def set_motion_detect(self, args):
228+
"""Set gesture detection status
229+
args = 0 to unset, 1 to set
230+
"""
231+
return self._run_command(_COMM_MOTION_CTRL, bytes([0x01, args]), 5)
232+
216233
def _run_command(self, cmd, args, resplen, flush=True):
217234
if flush:
218235
self._read_response(self._buffer, len(self._buffer))

0 commit comments

Comments
 (0)