コード例 #1
0
def subloop():
        while True:
                screen = i2c_lcd1602.Screen(bus=1, addr=0x27, cols=16, rows=2)
                line = "Personal Project"
                screen.enable_backlight()
                screen.clear()
                ADC0832.setup()
                line = sensor(line)
                return line
コード例 #2
0
#!/usr/bin/env python3

import RPi.GPIO as GPIO
import ADC0832
import os
import datetime
import time
import smbus
import ds18b20
import i2c_lcd1602

screen = i2c_lcd1602.Screen(bus=1, addr=0x27, cols=16, rows=2)

line = "Personal Project"
screen.enable_backlight()
screen.clear()


ADC0832.setup()
#path_w = 'brightness.txt'


#for i in range(10):
# 72 で 1 時間、72x6 時間で 432 288 4 時間、864 で 12 時間

def sensor(line):
#    screen.cursorTo(0, 0)
#    screen.println(line)

# 温度検知
    t = ds18b20.dsb20Read()
コード例 #3
0
ファイル: display.py プロジェクト: thangndu/pigate
import i2c_lcd1602 as lcd
import os
import paho.mqtt.client as mqtt
import time

screen = lcd.Screen(bus=1, addr=0x3f, cols=16, rows=2)
time.sleep(1)
text = "                "
screen.enable_backlight()
screen.display_data(text)


def on_message(client, userdata, message):
    global screen
    m = str(message.payload.decode("utf-8"))
    screen.display_data(m)
    print m


#broker_address="192.168.2.175"
broker_address = "iot.eclipse.org"

print("creating new instance")
client = mqtt.Client("display_sub")  #create new instance
client.on_message = on_message  #attach function to callback
print("connecting to broker")
client.connect(broker_address)  #connect to broker

print("connected to broker")

client.loop_start()  #start the loop