本文整理汇总了Python中display.Display.writeChar方法的典型用法代码示例。如果您正苦于以下问题:Python Display.writeChar方法的具体用法?Python Display.writeChar怎么用?Python Display.writeChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类display.Display
的用法示例。
在下文中一共展示了Display.writeChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Display
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import writeChar [as 别名]
import time
import datetime
from display import Display
# ===========================================================================
# Clock Example
# ===========================================================================
segment = Display(address=0x70)
print "Press CTRL+Z to exit"
# Continually update the time on a 4 char, 7-segment display
while(True):
now = datetime.datetime.now()
hour = now.hour
minute = now.minute
second = now.second
# Set hours
segment.writeChar(0, 'A')
segment.writeChar(1, 'Z')
segment.writeChar(2, 'C')
segment.writeChar(3, 'D')
#segment.writeDigit(0, 0xF) # Tens
#segment.writeDigit(1, 0xF) # Ones
# Set minutes
#segment.writeDigit(3, 0xF) # Tens
#segment.writeDigit(4, OxF) # Ones
# Wait a quarter second (less than 1 second to prevent colon blinking getting in phase with odd/even seconds).
time.sleep(1)