@sinovoip wrote:
webduino support graphical programming, so you can use it to control LED .
if you check the red box button, you can see js code:
var rgbled; boardReady({board: 'Smart', url: '10.73.83.110'}, function (board) { board.systemReset(); board.samplingInterval = 50; rgbled = getRGBLedCathode(board, 15, 12, 13); rgbled.setColor('#ff0000'); });
so we can try to use nodejs to control it:
first , we can start official open source js,code at : https://github.com/webduinoio/webduino-js
at first , you must install nodejs .
1, create a led dir
2, install webduino js libcd led npm install webduino-js
3 ,create led.js file:
var webduino = require('webduino-js'); var board, rgbled; board = new webduino.board['Smart']({url: '10.73.83.110'}); function getRGBLedCathode(board, red, green, blue) { return new webduino.module.RGBLed(board, board.getDigitalPin(red), board.getDigitalPin(green), board.getDigitalPin(blue), webduino.module.RGBLed.COMMON_CATHODE); } board.on('ready', function() { console.log("board ready") board.systemReset(); board.samplingInterval = 500; rgbled = getRGBLedCathode(board, 15, 12, 13); rgbled.setColor('#0000ff'); console.log("board end") });
so you can control led with nodejs code.
Posts: 1
Participants: 1