作家
登录

基于Python和JavaScript编写物联网温度计程序

作者: 来源: 2017-05-08 11:16:15 阅读 我要评论

 
  • print("STARTING..." 
  • try:  
  • # Device UID and TOKEN can be created in the ADM panel  
  • zapp = zerynthapp.ZerynthApp("DEVICE UID""DEVICE TOKEN",ip = "178.22.65.123", log=True 
  • connect to the wifi network (Set your SSID and password below)  
  • wifi_driver.init(SERIAL2,D24) # slot B  
  • for i in range(0,5):  
  • try:  
  • wifi.link("SSID",wifi.WIFI_WPA2,"PASSWORD" 
  • break  
  • except Exception as e:  
  • print("Can't link",e)  
  • else 
  • print("Impossible to link!" 
  • while True 
  • sleep(1000)  
  • # Start the Zerynth app instance!  
  • # Remember to create a template with the files under the "template" folder you just cloned  
  • # upload it to the ADM and associate it with the connected device  
  • zapp.run()  
  • Read the sensor and send values to the ADM  
  • while True 
  • sleep(1000)  
  • tmp, hum = temp_hum.get_temp_humidity() # Read tmp and hum  
  • print("Temp is:", tmp, "Humidity is:", hum)  
  • try:  
  • zapp.event({"data":tmp})  
  • except Exception as e:  
  • print(e) 

      推荐阅读

      3G关闭倒计时引发全网通换机潮?

    5月5日消息,近日中国电信宣布一条通知布告:因收集进级和技巧更新,自2017年6月1日起,部分老旧手机终端用户>>>详细阅读


    本文标题:基于Python和JavaScript编写物联网温度计程序

    地址:http://www.17bianji.com/lsqh/35053.html

  • 关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)