UNPKG

@gemini86/node-red-ds18b20

Version:

Node-RED node for ds18b20 sensors connected on GPIO (fork of iiot2k, which was removed from NPM)

28 lines (20 loc) 497 B
/* * example turns output on and after 3s off * * run: * > node onoff.js * * onoff.js * */ "use strict"; const gpiox = require("../gpiox"); const OUTPUT_PIN = 20; console.log("*** on/off node.js example ***"); console.log("output pin is gpio", OUTPUT_PIN); console.log("led turns after 3000 ms off"); gpiox.init_gpio(OUTPUT_PIN, gpiox.GPIO_MODE_OUTPUT, 1); setTimeout(() => { gpiox.set_gpio(OUTPUT_PIN, 0); gpiox.deinit_gpio(OUTPUT_PIN); }, 3000);