示例#1
0
def init():
  lcd.init()
  lcd.cls()
  lcd.backlight(ON)

  wiringpi.pinMode(BUTTON_OK,INPUT)
  wiringpi.pinMode(BUTTON_FKEY,INPUT)
示例#2
0
def main():
    lcd.init()
    lcd.set_contrast(190)
    lcd.backlight(1)
    lcd.text("adresses:")
    ip = subprocess.check_output("hostname -I", shell=True)
    lcd.locate(0,1)
    lcd.text(str(ip.strip()) )
示例#3
0
def main():
    lcd.init()
    lcd.cls()
    lcd.data(smiley)
    lcd.locate(2,2)
    lcd.data(ch)
    lcd.locate(3,0)
    lcd.text("c.a.h.")
    lcd.backlight(1)
示例#4
0
def main():
    lcd.init()
    lcd.backlight(1)
    sample = CpuTemperature()
    #sample = LoadAverage()
    buf = RingBuffer(84)

    while True:
        current = sample.data()
        buf.append(current)
        lcd.image(render(buf))
        lcd.locate(0,0)
        lcd.text(sample.format(current))
        time.sleep(1)
示例#5
0
    , 832: (95.9, "MBC FM"), 831: (  91.9, "MBC FM4U")
    , 834: (103.5, "SBS 러브 FM"), 835: ( 107.7, "SBS 파워 FM")
    , 822 :( 98.1 ,"CBS 표준 FM"), 821: ( 93.9, "CBS 음악 FM")
    , 823: ( 104.5, "EBS 라디오")
    , 820: ( 101.9, "BBS 불교방송"), 837: ( 95.1, "TBS 교통방송")
      # , 'MILITARY': 101.1
      # , 'EASTPOLE': 106.9, 'AFN': 102.7, 'KYUNGKI': 99.9
      # , 'YTNRADIO': 94.5, 'PYNGHWA': 104.5
}

import json, requests
import sys , time
from PIL import Image,ImageDraw,ImageFont
import pcd8544.lcd as lcd

lcd.init()
lcd.cls()

# load an available True Type font
font = ImageFont.truetype("/usr/share/fonts/truetype/unfonts-core/UnBatang.ttf", 14)

# New b-w image

#im = Image.new('1', (84,48))
# New drawable on image
#draw = ImageDraw.Draw(im)

tea = tea5767()
global isHolding
isHolding = False
global old_val
示例#6
0
 def __init__(self):
   # Initialize LCD
   lcd.init()
   # Turn the backlight on/off and adjust it
   lcd.backlight(0)
            fields = []
            continue

        field = line.strip().split('=')
        # print(field)
        fields.append(field[1].decode('utf-8'))

    fd.close()
    os.close(fifo)

    lcd.cls()


if __name__ == '__main__':

    lcd.init(contrast=0xBB)
    demo()

    time.sleep(2)
    lcd.cls()

    display_volume_bar()
    display_banner()

    font_info = {
        'font': Font('Zpix.ttf', 12),
        'imageFont1': ImageFont.truetype("Zpix.ttf", 12),
        'imageFont2': ImageFont.truetype("DejaVuSansMono.ttf", 12),
    }

    read_now_playing(**font_info)
示例#8
0
def main():
    lcd.init()
    lcd.backlight(1)
    stats()
def daemon():
    client = InfluxDBClient('cms.emon.ee', 8086, 'USER', 'PASSWORD', DBNAME,timeout=30)
    ow.init('localhost:4304')
    lcd.init()
    logging.debug("Daemon starting")
    logging.debug("Create INFLUX database: " + DBNAME)
    errors = 0
    try:
        client.create_database(DBNAME)
    except InfluxDBClientError:
        logging.debug("%s DB already exist" % DBNAME)
        pass
    except:
        logging.exception("Error")
        lcd.text("Exception")
   # try:
   #     client.create_retention_policy('awesome_policy', '3d', 3, default=True)
   # except InfluxDBClientError:
   #     logging.debug("%s policy already exist" % DBNAME)
   #     pass

    
    while True:
        try:
            devices = ow.Sensor('/').sensorList()
            date = datetime.now()
            points=[]
            for o in read_dht11():
                devices.append(o)
            devices.append(calc_power())
            for sensor in devices:
                name = sensor.address
                try:
                    value = float(sensor.value)
                except:
                    value = float(ow.Sensor('/%s' % name).temperature11)
                desc = name
                json_body = {   
                       "time": date.strftime('%Y-%m-%dT%H:%M:%SZ'),
                       "measurement": "rosma_temps",
                       "tags": {
                           "sensor": name,
                       },
                       "fields": {
                           "value": value
                       }
                   }
                points.append(json_body)
                value2lcd(date.strftime('%d/%m/%y %H:%M:%S'),name,desc,value)
                logging.debug(json_body)
            status=client.write_points(points)
            if status:
                lcd.text("Sent<-OK")
                logging.debug(status)
            else:
                lcd.text("Error!")
                logging.error(status)
            #Show status
            s=0
            lcd.cls()
            while s<sleep:
                lcdstatusupdate(len(devices),s)
                time.sleep(1)
                s+=1
        except:
                logging.exception("Error occurred %s" % sys.exc_info()[1])
                lcd.text("%s Exception!" % errors)
                time.sleep(1)
                if errors == 10:
                     lcd_blink("Rebooting!")
                     d = threading.Thread(name='beeper', target=beeper)
                     d.setDaemon(True)
                     d.start()
                     #os.system("reboot")
                     d.join()
                else:
                    errors += 1
    logging.debug("Daemon exiting")
    return(0)
示例#10
0
 def __init__(self):
     lcd.init()
     lcd.backlight(1)
     lcd.cls()