2to3
parent
4bec9e183d
commit
00ab3b599c
|
@ -1,8 +1,8 @@
|
||||||
# this gives number of people present via spaceapi
|
# this gives number of people present via spaceapi
|
||||||
# but if network down, this does not work
|
# but if network down, this does not work
|
||||||
# better get data direct from pidor or peoplecounter
|
# better get data direct from pidor or peoplecounter
|
||||||
import urllib, json
|
import urllib.request, urllib.parse, urllib.error, json
|
||||||
url = "https://spaceapi.syn2cat.lu/status/json"
|
url = "https://spaceapi.syn2cat.lu/status/json"
|
||||||
response = urllib.urlopen(url);
|
response = urllib.request.urlopen(url);
|
||||||
data = json.loads(response.read())
|
data = json.loads(response.read())
|
||||||
print data["sensors"]["people_now_present"][0]["value"]
|
print(data["sensors"]["people_now_present"][0]["value"])
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# sets color of first neo pixel
|
# sets color of first neo pixel
|
||||||
from __future__ import division
|
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
from math import *
|
from math import *
|
||||||
|
@ -66,7 +66,7 @@ if __name__ == '__main__':
|
||||||
if ( valid != "yes" ):
|
if ( valid != "yes" ):
|
||||||
continue
|
continue
|
||||||
if(action == "set"):
|
if(action == "set"):
|
||||||
print "Color set to: ",r,g,b
|
print("Color set to: ",r,g,b)
|
||||||
for i in range(0,LED_COUNT):
|
for i in range(0,LED_COUNT):
|
||||||
strip.setPixelColor(i, Color(r,g,b))
|
strip.setPixelColor(i, Color(r,g,b))
|
||||||
showit()
|
showit()
|
||||||
|
@ -75,11 +75,11 @@ if __name__ == '__main__':
|
||||||
if(not tmp):
|
if(not tmp):
|
||||||
continue
|
continue
|
||||||
i=clockcalc(int(tmp))
|
i=clockcalc(int(tmp))
|
||||||
print "Digit ",i," set to: ",r,g,b
|
print("Digit ",i," set to: ",r,g,b)
|
||||||
strip.setPixelColor(i, Color(r,g,b))
|
strip.setPixelColor(i, Color(r,g,b))
|
||||||
showit()
|
showit()
|
||||||
if(action == "morse"):
|
if(action == "morse"):
|
||||||
print "Morsing with: ",r,g,b
|
print("Morsing with: ",r,g,b)
|
||||||
speed=10
|
speed=10
|
||||||
for i in range(0,LED_COUNT):
|
for i in range(0,LED_COUNT):
|
||||||
strip.setPixelColor(i, Color(0,0,0))
|
strip.setPixelColor(i, Color(0,0,0))
|
||||||
|
@ -112,7 +112,7 @@ if __name__ == '__main__':
|
||||||
showit()
|
showit()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if(action == "pulse"):
|
if(action == "pulse"):
|
||||||
print "Pulsing with: ",r,g,b
|
print("Pulsing with: ",r,g,b)
|
||||||
pulsewidth=50
|
pulsewidth=50
|
||||||
while (action==myredis.get('neoaction')):
|
while (action==myredis.get('neoaction')):
|
||||||
for i in range(pulsewidth):
|
for i in range(pulsewidth):
|
||||||
|
@ -141,14 +141,14 @@ if __name__ == '__main__':
|
||||||
time.sleep(50/1000.0)
|
time.sleep(50/1000.0)
|
||||||
|
|
||||||
if(action == "flash"):
|
if(action == "flash"):
|
||||||
print "Flashing with: ",r,g,b
|
print("Flashing with: ",r,g,b)
|
||||||
print myredis.get('neoaction')
|
print(myredis.get('neoaction'))
|
||||||
wait_ms=50
|
wait_ms=50
|
||||||
"""Rainbow movie theater light style chaser animation."""
|
"""Rainbow movie theater light style chaser animation."""
|
||||||
while (action==myredis.get('neoaction')):
|
while (action==myredis.get('neoaction')):
|
||||||
print " Flashing with: ",r,g,b
|
print(" Flashing with: ",r,g,b)
|
||||||
for j in range(256):
|
for j in range(256):
|
||||||
print " Flashing with: ",r,g,b
|
print(" Flashing with: ",r,g,b)
|
||||||
if(action!=myredis.get('neoaction')):
|
if(action!=myredis.get('neoaction')):
|
||||||
break
|
break
|
||||||
for q in range(3):
|
for q in range(3):
|
||||||
|
|
|
@ -9,7 +9,7 @@ GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(buttonpin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
GPIO.setup(buttonpin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print "waiting..."
|
print("waiting...")
|
||||||
os.system('logger shutdownbutton waiting for press...')
|
os.system('logger shutdownbutton waiting for press...')
|
||||||
try:
|
try:
|
||||||
GPIO.wait_for_edge(buttonpin, GPIO.FALLING)
|
GPIO.wait_for_edge(buttonpin, GPIO.FALLING)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import urllib, json
|
import urllib.request, urllib.parse, urllib.error, json
|
||||||
url = "https://spaceapi.syn2cat.lu/status/json"
|
url = "https://spaceapi.syn2cat.lu/status/json"
|
||||||
response = urllib.urlopen(url);
|
response = urllib.request.urlopen(url);
|
||||||
data = json.loads(response.read())
|
data = json.loads(response.read())
|
||||||
print data["state"]["open"]
|
print(data["state"]["open"])
|
||||||
|
|
Loading…
Reference in New Issue