Commit 910fc1c8 authored by pi's avatar pi
Browse files

updated gitignore, updated GPIO_interface to be threaded.

parent d0859782
*~
backend/__pycache__
backend/flaschen.db
static_html/data/*
static-html/data/*
......@@ -3,6 +3,9 @@
import sys
import sqlite3
import time
import threading
import json
from musicpd import (MPDClient, CommandError)
from deleteEntries import deleteAll
from displayEntries import display
......@@ -71,14 +74,42 @@ f = open('../static-html/data/getraenke.json', 'w')
f.write(display('json'))
f.close()
print("starting loop")
while True:
buttonEvent('Club Mate' , 7)
buttonEvent('Mio Mate' , 8)
buttonEvent('Club Mate Cola', 25)
buttonEvent('Fritz Kola' , 24)
buttonEvent('Bionade' , 23)
buttonEvent('MischMasch' , 18)
# buttonEvent('KraftStoff' , 7)
class watchButtons(threading.Thread):
def run(self):
print("starting button loop")
while True:
buttonEvent('Club Mate' , 7)
buttonEvent('Mio Mate' , 8)
buttonEvent('Club Mate Cola', 25)
buttonEvent('Fritz Kola' , 24)
buttonEvent('Bionade' , 23)
buttonEvent('MischMasch' , 18)
class watchSound(threading.Thread):
def run(self):
print("starting sound loop")
client = MPDClient()
print("client object created:")
print(client)
client.connect('10.0.0.20',6600)
print("client connected")
while True:
f = open('../static-html/data/music.json', 'w')
f.write(json.JSONEncoder().encode(client.currentsong()))
f.close()
print(json.JSONEncoder().encode(client.currentsong()))
time.sleep(5)
try:
thread1 = watchButtons()
thread2 = watchSound()
thread1.start()
thread2.start()
except:
print("error creating threads")
while 1:
pass
GPIO.cleanup()
[
{ "Name" : "Club Mate", "Preis" : "100", "Bestand" : "10", "MaxBestand" : "20", "Bild" : "club-mate.png", "Farbe" : "red"},
{ "Name" : "Mio Mio Mate", "Preis" : "100", "Bestand" : "5", "MaxBestand" : "50", "Bild" : "mio.jpg", "Farbe" : "orange"},
{ "Name" : "Club Mate Cola", "Preis" : "80", "Bestand" : "22", "MaxBestand" : "80", "Bild" : "club-mate-cola.png", "Farbe" : "green"},
{ "Name" : "Fritz Kola", "Preis" : "80", "Bestand" : "20", "MaxBestand" : "20", "Bild" : "fritz-cola.jpg", "Farbe" : "red"},
{ "Name" : "Bionade", "Preis" : "80", "Bestand" : "20", "MaxBestand" : "20", "Bild" : "bionade.jpg", "Farbe" : "red"},
{ "Name" : "Mineralwasser", "Preis" : "100", "Bestand" : "20", "MaxBestand" : "20", "Bild" : "mineralwasser.jpg", "Farbe" : "red"}
]
{"title": "Spice Girls - Wannabe"}
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