Make clean scripts
parent
4bec9e183d
commit
f1bf78ca91
|
@ -1,3 +1,7 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-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
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
# sets color of first neo pixel
|
# sets color of first neo pixel
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import time
|
import time
|
||||||
|
@ -43,11 +44,11 @@ if __name__ == '__main__':
|
||||||
myredis=redis.StrictRedis(host='localhost', port=6379, db=0)
|
myredis=redis.StrictRedis(host='localhost', port=6379, db=0)
|
||||||
while True:
|
while True:
|
||||||
time.sleep(50/1000.0)
|
time.sleep(50/1000.0)
|
||||||
try:
|
try:
|
||||||
r=int(myredis.get('neored'))
|
r=int(myredis.get('neored'))
|
||||||
except:
|
except:
|
||||||
r=0
|
r=0
|
||||||
try:
|
try:
|
||||||
g=int(myredis.get('neogreen'))
|
g=int(myredis.get('neogreen'))
|
||||||
except:
|
except:
|
||||||
g=0
|
g=0
|
||||||
|
@ -109,7 +110,7 @@ if __name__ == '__main__':
|
||||||
morsep+=1
|
morsep+=1
|
||||||
strip.setPixelColor(morsep, Color(0,0,0))
|
strip.setPixelColor(morsep, Color(0,0,0))
|
||||||
morsep+=1
|
morsep+=1
|
||||||
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
|
||||||
|
@ -137,9 +138,9 @@ if __name__ == '__main__':
|
||||||
strip.setPixelColor(clockcalc(time.strftime('%M',time.localtime())),Color(30,0,0))
|
strip.setPixelColor(clockcalc(time.strftime('%M',time.localtime())),Color(30,0,0))
|
||||||
# put the seconds hand as green
|
# put the seconds hand as green
|
||||||
strip.setPixelColor(clockcalc(time.strftime('%S',time.localtime())),Color(0,30,0))
|
strip.setPixelColor(clockcalc(time.strftime('%S',time.localtime())),Color(0,30,0))
|
||||||
showit()
|
showit()
|
||||||
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')
|
||||||
|
@ -154,7 +155,7 @@ if __name__ == '__main__':
|
||||||
for q in range(3):
|
for q in range(3):
|
||||||
for i in range(0, strip.numPixels(), 3):
|
for i in range(0, strip.numPixels(), 3):
|
||||||
strip.setPixelColor(i+q, wheel((i+j) % 255))
|
strip.setPixelColor(i+q, wheel((i+j) % 255))
|
||||||
showit()
|
showit()
|
||||||
time.sleep(wait_ms/1000.0)
|
time.sleep(wait_ms/1000.0)
|
||||||
for i in range(0, strip.numPixels(), 3):
|
for i in range(0, strip.numPixels(), 3):
|
||||||
strip.setPixelColor(i+q, 0)
|
strip.setPixelColor(i+q, 0)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
buttonpin=24
|
buttonpin=24
|
||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
import time
|
import time
|
||||||
|
@ -11,11 +14,11 @@ 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)
|
||||||
print('Button Pressed')
|
print('Button Pressed')
|
||||||
os.system('logger shutdownbutton pressen. bye bye')
|
os.system('logger shutdownbutton pressen. bye bye')
|
||||||
os.system("shutdown now -h")
|
os.system("shutdown now -h")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
GPIO.cleanup() # clean up GPIO on CTRL+C exit
|
GPIO.cleanup() # clean up GPIO on CTRL+C exit
|
||||||
GPIO.cleanup() #
|
GPIO.cleanup() #
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import urllib, json
|
import urllib, json
|
||||||
|
|
||||||
url = "https://spaceapi.syn2cat.lu/status/json"
|
url = "https://spaceapi.syn2cat.lu/status/json"
|
||||||
response = urllib.urlopen(url);
|
response = urllib.urlopen(url);
|
||||||
data = json.loads(response.read())
|
data = json.loads(response.read())
|
||||||
|
|
Loading…
Reference in New Issue