forked from yorkhackspace/SpacehackClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lcd_enable_detect.py
31 lines (25 loc) · 1.01 KB
/
lcd_enable_detect.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
import Adafruit_BBIO.ADC as ADC
from Adafruit_CharLCD import Adafruit_CharLCD
from NokiaLCD import NokiaLCD
from collections import OrderedDict
import commands
import json
import time
#import game libraries
from gamelibs import config_manager
from gamelibs import lcd_manager
#Who am I? Get my ip address
ipaddress = commands.getoutput("/sbin/ifconfig").split("\n")[1].split()[1][5:]
#configuration. Load the config and get various dictionaries and arrays back
configFileName = 'game-' + ipaddress +'.config'
config, controlids, controldefs, sortedlist = config_manager.loadConfig(configFileName)
#initialise all of the LCDs and return a list of LCD objects
myLcdManager = lcd_manager.LcdManager(sortedlist, config)
for ctrlid in controlids:
myLcdManager.display(str(config['local']['controls'][ctrlid]['display']['pin']) + " (" + str(ctrlid) + ")", config['local']['controls'][ctrlid]['display']['width'], ctrlid)
#Main loop
while(True):
pass