本文整理汇总了Python中PiStorms.PiStorms.untilKeyPressOrTouch方法的典型用法代码示例。如果您正苦于以下问题:Python PiStorms.untilKeyPressOrTouch方法的具体用法?Python PiStorms.untilKeyPressOrTouch怎么用?Python PiStorms.untilKeyPressOrTouch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PiStorms.PiStorms
的用法示例。
在下文中一共展示了PiStorms.untilKeyPressOrTouch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PiStorms
# 需要导入模块: from PiStorms import PiStorms [as 别名]
# 或者: from PiStorms.PiStorms import untilKeyPressOrTouch [as 别名]
import ConfigParser
from PiStorms import PiStorms
psm = PiStorms()
config = ConfigParser.RawConfigParser()
config.read("/usr/local/mindsensors/conf/msdev.cfg")
homefolder = config.get("msdev", "homefolder")
try:
with open(os.path.join(homefolder, ".version"), "r") as f:
version_no = f.readline().strip()
except IOError:
version_no = "unknown"
psm.screen.drawDisplay("About Me")
psm.screen.termPrintln("Device: {}".format(psm.GetDeviceId().rstrip("\0")))
psm.screen.termPrintln("Feature: {}".format(psm.psc.GetDeviceFeatures().rstrip("\0")))
psm.screen.termPrintln("f/w version: {}".format(psm.GetFirmwareVersion().rstrip("\0")))
psm.screen.termPrintln("s/w version: {}".format(version_no))
psm.screen.termPrintln("Hostname: {}".format(socket.gethostname()))
psm.screen.termPrintln("Battery: {}V".format(psm.battVoltage()))
def getIP(iface):
ip = os.popen("ifconfig {} | tail +2 | awk '/inet / {{print $2}}'".format(iface)).read()
return ip if ip != '' else "not present"
def updateNetworkInfo():
psm.screen.termPrintAt(6, "eth0: {}".format(getIP("eth0")))
psm.screen.termPrintAt(7, "wlan0: {}".format(getIP("wlan0")))
psm.untilKeyPressOrTouch(updateNetworkInfo)
psm.screen.termPrintAt(8, "Exiting to menu")