From 8db0a69c202dab72d2100329f7a34f1b1f6e6dc2 Mon Sep 17 00:00:00 2001 From: Jake Ross Date: Tue, 24 Apr 2018 09:33:05 -0600 Subject: [PATCH] added examples directory --- examples/__init__.py | 25 ++++++++++++++++++++++++ examples/capture_loop.py | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 examples/__init__.py create mode 100644 examples/capture_loop.py diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 0000000..9671591 --- /dev/null +++ b/examples/__init__.py @@ -0,0 +1,25 @@ +# =============================================================================== +# Copyright 2015 Jake Ross +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# =============================================================================== + +# ============= enthought library imports ======================= +# ============= standard library imports ======================== +# ============= local library imports ========================== + + +# ============= EOF ============================================= + + + diff --git a/examples/capture_loop.py b/examples/capture_loop.py new file mode 100644 index 0000000..280af84 --- /dev/null +++ b/examples/capture_loop.py @@ -0,0 +1,42 @@ +# =============================================================================== +# Copyright 2018 ross +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# =============================================================================== +import time + +from camera import ToupCamCamera + + +def main(): + + cam = ToupCamCamera() + cam.open() + + # wait for camera to startup + time.sleep(2) + + # capture n images + n = 10 + # every t seconds + t = 2 + + for i in xrange(n): + path = 'test_image-{:02d}.jpg'.format(i) + cam.save(path) + time.sleep(t) + + +if __name__ == '__main__': + main() +# ============= EOF =============================================