webiopi学习笔记(三)
来源:互联网 发布:txt编辑软件 编辑:程序博客网 时间:2024/05/09 21:14
1.python函数:
(1)基础:
import webiopiGPIO = webiopi.GPIOGPIO.setFunction(LIGHT, GPIO.OUT)GPIO.digitalWrite(LIGHT, GPIO.HIGH)GPIO.digitalRead(LIGHT)webiopi.sleep(1)
(2)python宏:
import webiopi@webiopi.macrodef getLightHours(): return "%d;%d" % (HOUR_ON, HOUR_OFF)@webiopi.macrodef setLightHours(on, off): global HOUR_ON, HOUR_OFF HOUR_ON = int(on) HOUR_OFF = int(off) return getLightHours()
2.JS函数
(1)基础:
<script type="text/javascript" src="/webiopi.js"></script>var button = webiopi().createGPIOButton(17, "Light");webiopi().refreshGPIO(true);
(2)js中使用宏
webiopi().callMacro("getLightHours", [], updateLightHours);</span>
var sendButton = webiopi().createButton("sendButton", "Send", function() { // Arguments sent to the macro var hours = [$("#inputOn").val(), $("#inputOff").val()]; // Call the macro webiopi().callMacro("setLightHours", hours, updateLightHours); });
0 0
- webiopi学习笔记(三)
- webiopi学习笔记(一)
- webiopi学习笔记(二)
- 树莓派学习笔记——webiopi安装与入门
- 树莓派学习笔记——webiopi配置文件说明
- 树莓派学习笔记——webiopi网页控制LED
- 树莓派学习笔记——webiopi装配与入门
- 树莓派学习笔记——webiopi网页统制LED
- 学习笔记(三)
- 学习笔记(三)
- 学习笔记(三)
- 学习笔记(三)
- 学习笔记(三)
- 学习笔记(三)
- 树莓派3B+ 网页控制GPIO(WebIOPi)
- C#学习笔记(三)
- 数据库学习笔记(三)
- Duwamish7学习笔记(三)
- 星星
- 拷贝构造函数的参数类型必须是引用
- f'd'h'd'h
- 杭电ACM水仙花数
- 字符串的逆序之旅
- webiopi学习笔记(三)
- HDU 1874 迪杰斯特拉
- 鸟哥的Linux私房菜02_Linux使用和man page
- Linux平台驱动-LED驱动(Micro2440 + linux 2.6.39)
- Apache httpd与tomcat集群
- 经典滤波算法总结
- HDU 4324 topological_sort
- android ndk
- 字符串逆序输出 【杭电-1062】 附题