Download Introduction to pcDuino
Transcript
blink_led.js:
/**
* blink_led.js, simple node.js test code for pcduino (http://www.pcduino.com)
* base on the source code from https://github.com/jheising/node.pcduino.git
*/
var fs = require('fs');
var led_pin;
var INPUT = 0;
var OUTPUT = 1;
var LOW = 0;
var HIGH = 1;
function digitalWrite(pin, value)
{
fs.writeFileSync("/sys/devices/virtual/misc/gpio/mode/gpio" + pin, String(value));
}
function pinMode(pin, mode)
{
fs.writeFileSync("/sys/devices/virtual/misc/gpio/mode/gpio" + pin, String(mode));
}
function delay(ms)
{
104