Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aubreymoore/5e051db73c06753ddf4baa8cf943cea3 to your computer and use it in GitHub Desktop.
Save aubreymoore/5e051db73c06753ddf4baa8cf943cea3 to your computer and use it in GitHub Desktop.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1. Turn on the camera and activate wifi by holding down the menu button.\n",
"2. Connect computer the the camera using wifi.\n",
"3. Run code in the following cells."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import urllib2\n",
"import time"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
"source": [
"root = 'http://192.168.0.10/'\n",
"cammode = ''\n",
"\n",
"def doit(command):\n",
" print urllib2.urlopen(root + command).read()\n",
"\n",
"def get_commandlist(): \n",
" doit('get_commandlist.cgi')\n",
"\n",
"def start_shutter_mode():\n",
" global cammode\n",
" doit('switch_cammode.cgi?mode=shutter')\n",
" cammode = 'shutter'\n",
" \n",
"def start_play_mode():\n",
" global cammode\n",
" doit('switch_cammode.cgi?mode=play')\n",
" cammode = 'play'\n",
"\n",
"def get_gpsrecordinglog():\n",
" if cammode != 'play':\n",
" print('switching to play mode')\n",
" start_play_mode\n",
" time.sleep(1)\n",
" doit('get_gpsrecordinglog.cgi')\n",
" \n",
"def take_picture():\n",
" if cammode != 'shutter':\n",
" print('switching to shutter mode')\n",
" start_shutter_mode\n",
" time.sleep(1) \n",
" doit('exec_shutter.cgi?com=1st2ndpush')\n",
" doit('exec_shutter.cgi?com=2nd1strelease')\n",
" \n",
"def power_off():\n",
" doit('exec_pwoff.cgi')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
"source": [
"# Capture 5 images\n",
"for i in range(5):\n",
" take_picturet(i)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment