コード例 #1
0
def show_lcd(message, line=1) :
	if line == 1 :
		lcd.home()
		lcd.message(message)
	if line == 2 :
		lcd.setCursor(1,2)
		lcd.message(message)
コード例 #2
0
def setup():
    print ("starting Poolpi...")

    log.init()

    log.log(log.ALWAYS, "***********************************")
    log.log(log.ALWAYS, "Starting PoolPi " + VERSION + "  " + DATE)
    log.log(log.ALWAYS, "***********************************")
    cfg.VERSION = VERSION

    # init pijuice to monitor power status
    if (power.init() == ERROR):
        gv.piJuicePresent = False;

    # init equipment control
    if (equipment.init() == ERROR):
        return ERROR

    # init serial and lcd
    if (lcd.init() == ERROR):
        return ERROR

    lcd.setCursor(1,1)
    lcd.printLineCenter(VERSION)
    lcd.setCursor(2,1)
    lcd.printLineCenter(DATE)

    # init buttons
    buttons.init()

    # init event timer
    timer.init()

    # init redis
    redispy.init()

    # start temp sensor thread
    ow.init()
    if (ow.start() == ERROR):
        return ERROR

    log.log(log.ALWAYS, "setup() complete")
    return NOERROR
コード例 #3
0
ファイル: toxic.py プロジェクト: hex007/toxic
from os import system as sys
from time import sleep
from transmission import Transmission
import lcd


lcd = lcd.lcd()
lcd.begin(16,2)
lcd.clear()

sys("service transmission-daemon start")
lcd.clear()
lcd.message("Booting to TOXIC\nT-  seconds left")
for i in range(5,0,-1):
	lcd.setCursor(2,1)
	lcd.message(str(i))
	sleep(1)

# Enter specific details here
client = Transmission(host='IP_ADDRESS', port=PORT, username='******', password='******')
lcd.clear()
lcd.message("TOX: __d __s __p\nUp:____|Dwn:____")

def adjust(speed):
	speed = int(speed)/1024
	if speed < 1000 :
		speed = str(str(speed)+'K').rjust(4)
	else :
		speed = str(float(speed)/1024)
		speed = str(speed[0:speed.find('.')]+'M').rjust(4)
コード例 #4
0
ファイル: buttons.py プロジェクト: tbitson/PoolPi
def delay_ms(delay):
    start = time.time() * 1000.0
    while ((time.time() * 1000.0 - start) < delay):
        pass
    return time.time() * 1000.0 - start


#---------------------------------------------------------------------------

if __name__ == '__main__':

    log.init()
    init()

    lcd.init()
    lcd.setCursor(1, 1)
    lcd.printStr("Button Test")

    print
    print("Press a button to test. Button 4 to end")

    val = 0
    loop = True
    while (loop):
        val = readButtons()
        if (val > 0):
            lcd.setCursor(2, 1)
            lcd.printStr("Button " + str(val) + "  ")
            print("Button " + str(val) + " is pressed")
            if (val == 4):
                loop = False