本文整理汇总了Python中arduino.Arduino.clear方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.clear方法的具体用法?Python Arduino.clear怎么用?Python Arduino.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arduino.Arduino
的用法示例。
在下文中一共展示了Arduino.clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WhatsHappening
# 需要导入模块: from arduino import Arduino [as 别名]
# 或者: from arduino.Arduino import clear [as 别名]
class WhatsHappening(object):
_screenPos = 0
_mail = Mail()
_owm = pyowm.OWM('4c046ad50263519b269d79a1e9453a53')
def __init__(self, port):
self._arduino = Arduino(port)
def update(self):
#ip = socket.gethostbyname(socket.gethostname())
if self._screenPos == 0:
observation = self._owm.weather_at_place('halifax,ns')
w = observation.get_weather()
temp = w.get_temperature(unit='celsius')['temp']
status = w.get_status()
hum = w.get_humidity()
line_one = '%s %dC %d%%' % (status, temp, hum)
line_two = '%s' % time.strftime("%a %b %d")
self._screenPos += 1
else:
line_one = 'Email:%d' % self._mail.unread_messages()
line_two = 'RAM:%d%% CPU:%d%%' % (psutil.virtual_memory().percent, psutil.cpu_percent())
self._screenPos = 0
self._arduino.clear()
self._arduino.write('%s\r\n%s' % (line_one, line_two))