foxd27 technical documentation Buy

Blinking LED

List of blinking led examples with Fox Board D27

Blink example in Node

Install Node Installing nodejs on FOX D27

Install the node-libgpiod

sudo apt update
sudo apt install libgpiod-dev
npm i node-libgpiod

Save this code in blink.js

const { version, Chip, Line } = require("node-libgpiod");

global.chip = new Chip(0);
global.line = new Line(chip, 32); // PB0 line

line.requestOutputMode();

var count=0;
const blink = () => {
    line.setValue(count-- % 2);
    setTimeout(blink,1000);
};

setTimeout(blink,1000);

Launch it:

sudo node blink

Home page foxd27 technical documentation Buy