作家
登录

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

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

 
  • 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 ADC and send values to the ADM  
  • while True 
  • sleep(1000)  
  • x = (adc.read(A4)*100)//4096  
  • zapp.event({"data":x})  
  • if x>95:  
  • # send mobile notification  
  • # (there is a limit of one notification per minute per device on the ADM sandbox)  
  • zapp.notify("ALARM!","The value is greater than 95!" 
  • except Exception as e:  
  • print(e) 
  • 这个示例中,Zerynth将大年夜相连的电路板获取的数据改变成可视化的图情势波器,这些模仿传感器的数据经由过程“模仿”pin A4产生。

    导入精确的wifi驱动法度榜样和传感器库

    正如你在注释中看到的,示例是基于 粒子光子板 和wifi驱动的。想要应用WiFi Plus Click,必须修改以下几行:

    1. from broadcom.bcm43362 import bcm43362 as wifi_driver 
    1. from microchip.mcw1001a import mcw1001a as wifi_driver 
    1. wifi_driver.auto_init() 

    然后采取 WiFi PLUS Click 将电路板连接到互联网, WiFi PLUS Click 具有MRF24WB0MA-2.4GHz特点,能兼容IEEE std 802.11微芯片模块,并且是车袈湄TCP/IP栈和802.11连接治理器匹配的MCW1001的┞菲握器。


      推荐阅读

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

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


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

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

    关键词: 探索发现

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

    网友点评
    自媒体专栏

    评论

    热度

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