var button;
boardReady({board: 'Smart', url: '192.168.11.104'}, function (board) {
board.systemReset();
board.samplingInterval = 50;
button = getPullupButton(board, 4);
button.on("pressed", function(){
console.log("pressed");
document.getElementById("demo-area-02-light").className = "on";
});
button.on("released", function(){
console.log("released");
document.getElementById("demo-area-02-light").className = "off";
});
});
程序运行效果按钮按下,网页上的灯泡亮了