本文整理汇总了Python中Adafruit_IO.Client.create_data方法的典型用法代码示例。如果您正苦于以下问题:Python Client.create_data方法的具体用法?Python Client.create_data怎么用?Python Client.create_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_IO.Client
的用法示例。
在下文中一共展示了Client.create_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Client
# 需要导入模块: from Adafruit_IO import Client [as 别名]
# 或者: from Adafruit_IO.Client import create_data [as 别名]
#Be sure to create a file called credentials.py with variables for the Adafruit feed key and a feed name to use
import credentials
from Adafruit_IO import Client, Feed, Data
print "Using AIO key " + credentials.aio_key + " to write data to feed " + credentials.feed_name
aio = Client(credentials.aio_key)
while True:
try:
in_data = raw_input("Enter data to feed to Adafruit or quit: ")
if in_data == "quit":
break
data = Data(value=int(in_data))
print "Writing " + in_data + " to feed"
aio.create_data(credentials.feed_name, data)
except:
print "caught exception"
print "Quitting"