Commit 368d737b authored by Caughlin Bohn's avatar Caughlin Bohn
Browse files

Added Idle scripts

parent 4fe6a529
from piglow import PiGlow
import time
import socket
import subprocess
import psutil
from random import randint
import urllib2, json
p = PiGlow()
val = 100
colour = 1
def sendCommand(command):
p = subprocess.Popen(command.split(" "), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate()
def getControlData():
rawData = urllib2.urlopen("http://192.168.1.1/network").read()
print(rawData)
controls = json.loads(rawData)
print(controls)
host = socket.gethostname()
print(controls[host])
return controls[host]
p.green(255)
time.sleep(30)
delay = 0.05
while True:
try:
p.all(0)
if getControlData():
print("in")
p.white(10)
time.sleep(delay)
p.blue(20)
time.sleep(delay)
p.green(30)
time.sleep(delay)
p.yellow(40)
time.sleep(delay)
p.orange(50)
time.sleep(delay)
p.red(60)
time.sleep(delay)
p.white(255)
time.sleep(delay)
p.red(0)
time.sleep(delay)
p.orange(0)
time.sleep(delay)
p.yellow(0)
time.sleep(delay)
p.green(0)
time.sleep(delay)
p.blue(0)
time.sleep(delay)
p.white(0)
time.sleep(delay)
else:
p.all(0)
#time.sleep(0.5)
except Exception as e:
print(e)
p.all(0)
p.red(255)
p.white(255)
import time
import sys
from neopixel import *
import argparse
from random import randint,choice
import socket
import urllib2, json
# LED strip configuration:
LED_COUNT = 100 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
#LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10 # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
strip.begin()
def getControlData():
rawData = urllib2.urlopen("http://192.168.1.1/network").read()
print(rawData)
controls = json.loads(rawData)
print(controls)
host = socket.gethostname()
print(controls[host])
return controls[host]
while True:
if getControlData():
r,g,b = randint(0,255),randint(0,255),randint(0,255)
strip.setPixelColor(randint(0,65),Color(r,g,b))
strip.show()
echo \{\"worker1\":0,\"worker2\":0,\"worker3\":0,\"worker4\":0,\"worker5\":0,\"worker6\":0,\"worker7\":0,\"worker8\":0\} > /var/www/html/control/index.html
echo \{\"LegionDisplay\":0,\"LegionHead\":0,\"LegionFile\":0\} > /var/www/html/network/index.html
echo \{\"worker1\":1,\"worker2\":1,\"worker3\":1,\"worker4\":1,\"worker5\":1,\"worker6\":1,\"worker7\":1,\"worker8\":1\} > /var/www/html/control/index.html
echo \{\"LegionDisplay\":1,\"LegionHead\":1,\"LegionFile\":1\} > /var/www/html/network/index.html
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment