コード例 #1
0
ファイル: 24.LCD_I2C.py プロジェクト: juunini2/raspberrypi
def LcdEnd(line1, line2):
    I2C.lcd_init()  # 초기화
    I2C.lcd_string(line1, I2C.LCD_LINE_1)  # 윗줄
    I2C.lcd_string(line2, I2C.LCD_LINE_2)  # 아랫줄
    time.sleep(3)
    I2C.lcd_init()  # 초기화
    sys.exit(1)
コード例 #2
0
ファイル: 24.LCD_I2C.py プロジェクト: juunini2/raspberrypi
def ScrollLeft(line1, line2):
    I2C.lcd_init()
    for i in range(10):
        I2C.lcd_string("%s%s" % (" " * (9 - i), line1), I2C.LCD_LINE_1)
        I2C.lcd_string("%s%s" % (" " * (9 - i), line2), I2C.LCD_LINE_2)
        time.sleep(0.01)
    time.sleep(1)
    I2C.lcd_init()
コード例 #3
0
ファイル: i2c_distance.py プロジェクト: juunini2/rasp
import RPi.GPIO as GPIO
import smbus
import time
import i2c_module as I2C
import distance_module as Distance

I2C.lcd_init()  # lcd 초기화

month_string = [
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
    "Nov", "Dec"
]
month_num = [
    "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
]

try:
    while True:
        time_split = time.ctime().split(" ")
        year = time_split[4]
        month = time_split[1]
        day = time_split[2]
        week = time_split[0]
        current_time = time_split[3]

        for i in range(0, 12):
            if month == month_string[i]:
                month = month_num[i]
                break

        I2C.lcd_string(
コード例 #4
0
import smbus
import time
import i2c_module as I2C

I2C.lcd_init()  # 초기화

I2C.lcd_string("Hello World", I2C.LCD_LINE_1)  # 윗줄
I2C.lcd_string("Connect Complete", I2C.LCD_LINE_2)  # 아랫줄

time.sleep(3)

I2C.lcd_init()  # 초기화

scroll = "Scroll"  # 스크롤 할 문자
whitespace = " "  # 공백

for i in range(0, 11):
    I2C.lcd_string("{}{}".format(whitespace * i, scroll), I2C.LCD_LINE_1)
    I2C.lcd_string("{}{}".format(whitespace * (10 - i), scroll),
                   I2C.LCD_LINE_2)
    time.sleep(0.01)  # 한계속도. 0.01초로 설정했지만 체감은 0.2 ~ 0.3초

time.sleep(1)
I2C.lcd_init()  # 초기화
コード例 #5
0
ファイル: 24.LCD_I2C.py プロジェクト: juunini2/raspberrypi
def StaticMessage(line1, line2):
    I2C.lcd_init()  # 초기화
    I2C.lcd_string(line1, I2C.LCD_LINE_1)  # 윗줄
    I2C.lcd_string(line2, I2C.LCD_LINE_2)  # 아랫줄
    time.sleep(3)
    I2C.lcd_init()
コード例 #6
0
ファイル: 24.LCD_I2C.py プロジェクト: juunini2/raspberrypi
def LcdAbort():
    I2C.lcd_init()  # 초기화
    I2C.lcd_string("   You Press    ", I2C.LCD_LINE_1)  # 윗줄
    I2C.lcd_string("    Ctrl - C    ", I2C.LCD_LINE_2)  # 아랫줄
    time.sleep(3)
    I2C.lcd_init()  # 초기화