Skip to content

Instantly share code, notes, and snippets.

@Morendil
Last active December 17, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Morendil/5520718 to your computer and use it in GitHub Desktop.
Save Morendil/5520718 to your computer and use it in GitHub Desktop.
Pythonista code to grab a gravity vector and babble it to an HTTP endpoint
from urllib2 import urlopen
from time import sleep
from scene import gravity, Scene, run
class MyScene (Scene):
def setup(self):
self.frames = 0
def draw(self):
self.frames += 1
if (self.frames % 30) == 0:
gvec = gravity()
urlopen('http://192.168.0.102:8080/%f,%f,%f' % (gvec.x,gvec.y,gvec.z)).read()
run(MyScene())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment