Esempio n. 1
0
def guest_scores(channel):
    global score_home
    global score_guest
    global cursor
    global db
    if score_home == max_score or score_guest == max_score:
        return ()
    print "Goal for guest team"
    score_guest = score_guest + 1
    print(score_home, score_guest)
    includes_display.show_score(tm, score_home, score_guest)
    if score_guest == max_score:
        blink_score(tm, score_home, score_guest, "Guest")
    write_score(score_home, score_guest, db, cursor)
Esempio n. 2
0
def reset_btn_pressed(channel):
    print "Game will be reset to 0:0"
    global score_home
    global score_guest
    global cursor
    global db
    score_home = 0
    score_guest = 0
    includes_display.show_score(tm,score_home,score_guest)
    #create new game
    try:
        cursor.execute("INSERT INTO `games` (name_home, score_home, score_guest, name_guest) VALUES ('', 0, 0, '')")
        db.commit()
    except:
        print "No DB connection or failure - new game"

    write_score(score_home,score_guest,db,cursor)
Esempio n. 3
0
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

#goal counter home
if lights == 0:
    GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
else:
    GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
#goal counter guest
if lights == 0:
    GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)
else:
    GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

#clear display and data at start
#add clear data here
includes_display.show_score(tm, 0, 0)
#at initial start: read max game_ID from database
try:
    #cursor.execute("SELECT MAX(game_id) FROM `games` WHERE 1")
    #max_id = cursor.fetchone()
    #print(max_id[0])
    #game_ID = max_id[0] + 1
    cursor.execute(
        "INSERT INTO `games` (name_home, score_home, score_guest, name_guest) VALUES ('', 0, 0, '')"
    )
    db.commit()
except:
    print "No DB connection or failure - init"


def write_score(score_home, score_guest, db, cursor):
Esempio n. 4
0
#!/usr/bin/env python3

from tm1637 import TM1637
import includes_display
#from time import time, sleep, localtime

# Setup Display
DIO=2
CLK=3
tm = TM1637(CLK, DIO)
tm.brightness(1)

#heim,gast
includes_display.show_score(tm,13,37)