Beispiel #1
0
def main():

  while True:
    on(RED)
    sleep(0.1)
    on(YELLOW)
    sleep(0.05)
    on(GREEN)
    sleep(0.025)
    on(BLUE)
    sleep(0.0125)
    on(WHITE)

    sleep(0.2)

    off(WHITE)
    sleep(0.025)
    off(BLUE)
    sleep(0.05)
    off(GREEN)
    sleep(0.1)
    off(YELLOW)
    sleep(0.2)
    off(RED)

    sleep(0.5)
Beispiel #2
0
def lightson():
    password = request.args.get('password', default="")
    if validate(password, keys.lightspassword):
        result = {}
        state = lights.on()
        return jsonify({'state': state.lower()})
    return directory('Invalid password. ', 'index.html')
Beispiel #3
0
def main():

  on(RED)

  p = GPIO.PWM(11, 50)
  p.start(0)

  for dc in range(0, 101, 1):
    p.ChangeDutyCycle(dc)
    sleep(0.05)

  p.ChangeDutyCycle(0)
  sleep(2)

  p.ChangeDutyCycle(100)

  p.stop()
Beispiel #4
0
def main():

  sleeptime = 0.05

  while True:
    off(WHITE)
    on(RED)
    sleep(sleeptime)

    off(RED)
    on(YELLOW)
    sleep(sleeptime)

    off(YELLOW)
    on(GREEN)
    sleep(sleeptime)

    off(GREEN)
    on(BLUE)
    sleep(sleeptime)

    off(BLUE)
    on(WHITE)
    sleep(sleeptime)
Beispiel #5
0
def main():

  on(RED)
  off(YELLOW)
  on(GREEN)
  off(BLUE)
  on(WHITE)

  while True:
    toggle(RED)
    toggle(YELLOW)
    toggle(GREEN)
    toggle(BLUE)
    toggle(WHITE)
    sleep(0.1)
Beispiel #6
0
import os
import time
import lights
import users

while True:
    os.system('clear')

    print("------------ Highscore ------------")

    highscore = users.highscore()

    for i, user in enumerate(highscore):
        print('{position}: {nick:10} score: {score}'.format(
            position=i + 1, nick=user['Nick'], score=user['totalTime']))

    print("---------- People online ----------")

    logged_in_users = users.logged_in()

    for user in logged_in_users:
        print(user['Nick'])

    if logged_in_users:
        lights.on()
    else:
        lights.off()

    time.sleep(3)
Beispiel #7
0
def lightsOn():
    flash('Lights On')
    lights.on()
    return redirect(url_for('.index'))