Ejemplo n.º 1
0
def disp_settings(channel):
    '''
    When GPIO pin 4 is pulled to GND,
    displays network status.
    '''

    status.network_status()  #Uptate network status
    cycle_rate = float(comdb.get_setting("lcd_cycle_rate"))
    #get current values
    ssid = str(comdb.get_setting("ssid"))
    ip_addr = str(comdb.get_setting("ip_addr"))

    if len(ip_addr) < 14 and len(ssid) < 11:
        lcd.lcd_clear()
        lcd.lcd_display_string("SSID:" + ssid, 1)
        lcd.lcd_display_string("IP:" + ip_addr, 2)
        sleep(cycle_rate)
        break
    #cycle through ip addres if longer than display
    if len(ip_addr) > 13:
        for i in range(len_ip - 12):
            lcd.lcd_clear()
            lcd.lcd_display_string("SSID:" + ssid, 1)
            lcd.lcd_display_string("IP:" + ip_addr[i:len_ip], 2)
            sleep(cycle_rate / (len_ip - 12))
            break
Ejemplo n.º 2
0
def new_sample ():
	'''
	Updates database to current sensor values.
	'''

	temp1 = sensor.get_temp()
	humi1 = sensor.get_humi()
	comdb.insert_temp(1, temp1)
	comdb.insert_humi(1, humi1)
	bt.data() #new data from arduino

	#sleep for set amount of time
	sample_rate = comdb.get_setting("sample_rate")
	threading.Timer(int(sample_rate), new_sample).start()
Ejemplo n.º 3
0
def output():
    '''
    Displays current sensor values on LCD display
    '''

    while True:
        cycle_rate = float(comdb.get_setting("lcd_cycle_rate"))

        #Inside Values
        temp1 = comdb.get_temp(1)
        humi1 = comdb.get_humi(1)
        pres1 = comdb.get_pres(1)
        lcd.lcd_clear()
        lcd.lcd_display_string("I: Temp. :" + str(temp1) + "C", 1)
        lcd.lcd_display_string("   Luftf.:" + str(humi1) + "%", 2)
        sleep(cycle_rate)

        #outside values
        temp2 = comdb.get_temp(2)
        humi2 = comdb.get_humi(2)
        lcd.lcd_clear()
        lcd.lcd_display_string("A: Temp. :" + str(temp2) + "C", 1)
        lcd.lcd_display_string("   Luftf.:" + str(humi2) + "%", 2)
        sleep(cycle_rate)
Ejemplo n.º 4
0
import RPi.GPIO as GPIO
import os
import comdb

btn_off_pin = int(comdb.get_setting("btn_off_pin"))
GPIO.setmode(GPIO.BCM)
GPIO.setup(btn_off_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)

try:
    GPIO.wait_for_edge(btn_off_pin, GPIO.FALLING)
    os.system("sudo shutdown now")
except:
    pass

GPIO.cleanup()
Ejemplo n.º 5
0
Archivo: read.py Proyecto: al3xius/WS
import comdb

comdb.insert_temp(2, 3)
comdb.insert_humi(2, 4)
comdb.insert_pres(2, 10)
print comdb.get_temp(2)
comdb.update_setting("sample_rate", 65)
print comdb.get_setting("sample_rate")
comdb.end_con()