Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initialise(red, green, blue) {
if (red && green && blue) {
pigpio.configureClock(10, pigpio.CLOCK_PWM); // Configures PiGPIO to use PWM as clock source (by default it uses PCM which conflicts with BeoCreate 4-Channel Amplifier).
pigpio.initialize(); // pigpio C library initialized here
ledR = new pigpio.Gpio(red, {mode: pigpio.Gpio.OUTPUT});
ledG = new pigpio.Gpio(green, {mode: pigpio.Gpio.OUTPUT});
ledB = new pigpio.Gpio(blue, {mode: pigpio.Gpio.OUTPUT});
ledInitialised = true;
beoBus.emit("general", {header: "requestShutdownTime", content: {extension: "led"}});
return true;
} else {
return false;
}
}
function initialise(red, green, blue) {
if (red && green && blue) {
pigpio.configureClock(10, pigpio.CLOCK_PWM); // Configures PiGPIO to use PWM as clock source (by default it uses PCM which conflicts with BeoCreate 4-Channel Amplifier).
pigpio.initialize(); // pigpio C library initialized here
ledR = new pigpio.Gpio(red, {mode: pigpio.Gpio.OUTPUT});
ledG = new pigpio.Gpio(green, {mode: pigpio.Gpio.OUTPUT});
ledB = new pigpio.Gpio(blue, {mode: pigpio.Gpio.OUTPUT});
ledInitialised = true;
beoBus.emit("general", {header: "requestShutdownTime", content: {extension: "led"}});
return true;
} else {
return false;
}
}
var blynkToken = 'blynk_token_here';
// *** Start code *** //
var locked = true
//Setup servo
var Gpio = require('pigpio').Gpio,
motor = new Gpio(motorPin, {mode: Gpio.OUTPUT}),
button = new Gpio(buttonPin, {
mode: Gpio.INPUT,
pullUpDown: Gpio.PUD_DOWN,
edge: Gpio.FALLING_EDGE
}),
led = new Gpio(ledPin, {mode: Gpio.OUTPUT});
//Setup blynk
var Blynk = require('blynk-library');
var blynk = new Blynk.Blynk(blynkToken);
var v0 = new blynk.VirtualPin(0);
console.log("locking door")
lockDoor()
button.on('interrupt', function (level) {
console.log("level: " + level + " locked: " + locked)
if (level == 0) {
if (locked) {
unlockDoor()
} else {
lockDoor()
var unlockedState = 1000;
var lockedState = 2200;
var motorPin = 14;
var buttonPin = 4
var ledPin = 17
var blynkToken = 'blynk_token_here';
// *** Start code *** //
var locked = true
//Setup servo
var Gpio = require('pigpio').Gpio,
motor = new Gpio(motorPin, {mode: Gpio.OUTPUT}),
button = new Gpio(buttonPin, {
mode: Gpio.INPUT,
pullUpDown: Gpio.PUD_DOWN,
edge: Gpio.FALLING_EDGE
}),
led = new Gpio(ledPin, {mode: Gpio.OUTPUT});
//Setup blynk
var Blynk = require('blynk-library');
var blynk = new Blynk.Blynk(blynkToken);
var v0 = new blynk.VirtualPin(0);
console.log("locking door")
lockDoor()
button.on('interrupt', function (level) {
var motorPin = 14;
var buttonPin = 4
var ledPin = 17
var blynkToken = 'blynk_token_here';
// *** Start code *** //
var locked = true
//Setup servo
var Gpio = require('pigpio').Gpio,
motor = new Gpio(motorPin, {mode: Gpio.OUTPUT}),
button = new Gpio(buttonPin, {
mode: Gpio.INPUT,
pullUpDown: Gpio.PUD_DOWN,
edge: Gpio.FALLING_EDGE
}),
led = new Gpio(ledPin, {mode: Gpio.OUTPUT});
//Setup blynk
var Blynk = require('blynk-library');
var blynk = new Blynk.Blynk(blynkToken);
var v0 = new blynk.VirtualPin(0);
console.log("locking door")
lockDoor()
button.on('interrupt', function (level) {
console.log("level: " + level + " locked: " + locked)
if (level == 0) {
function initialise(red, green, blue) {
if (red && green && blue) {
pigpio.configureClock(10, pigpio.CLOCK_PWM); // Configures PiGPIO to use PWM as clock source (by default it uses PCM which conflicts with BeoCreate 4-Channel Amplifier).
pigpio.initialize(); // pigpio C library initialized here
ledR = new pigpio.Gpio(red, {mode: pigpio.Gpio.OUTPUT});
ledG = new pigpio.Gpio(green, {mode: pigpio.Gpio.OUTPUT});
ledB = new pigpio.Gpio(blue, {mode: pigpio.Gpio.OUTPUT});
ledInitialised = true;
beoBus.emit("general", {header: "requestShutdownTime", content: {extension: "led"}});
return true;
} else {
return false;
}
}
function terminate() {
turnOff();
pigpio.terminate(); // pigpio C library terminated here
beoBus.emit("general", {header: "shutdownComplete", content: {extension: "led"}});
}
var motorPin = 14;
var buttonPin = 4
var ledPin = 17
var blynkToken = 'blynk_token_here';
// *** Start code *** //
var locked = true
//Setup servo
var Gpio = require('pigpio').Gpio,
motor = new Gpio(motorPin, {mode: Gpio.OUTPUT}),
button = new Gpio(buttonPin, {
mode: Gpio.INPUT,
pullUpDown: Gpio.PUD_DOWN,
edge: Gpio.FALLING_EDGE
}),
led = new Gpio(ledPin, {mode: Gpio.OUTPUT});
//Setup blynk
var Blynk = require('blynk-library');
var blynk = new Blynk.Blynk(blynkToken);
var v0 = new blynk.VirtualPin(0);
console.log("locking door")
lockDoor()
button.on('interrupt', function (level) {
console.log("level: " + level + " locked: " + locked)
if (level == 0) {
if (locked) {
var buttonPin = 4
var ledPin = 17
var blynkToken = 'blynk_token_here';
// *** Start code *** //
var locked = true
//Setup servo
var Gpio = require('pigpio').Gpio,
motor = new Gpio(motorPin, {mode: Gpio.OUTPUT}),
button = new Gpio(buttonPin, {
mode: Gpio.INPUT,
pullUpDown: Gpio.PUD_DOWN,
edge: Gpio.FALLING_EDGE
}),
led = new Gpio(ledPin, {mode: Gpio.OUTPUT});
//Setup blynk
var Blynk = require('blynk-library');
var blynk = new Blynk.Blynk(blynkToken);
var v0 = new blynk.VirtualPin(0);
console.log("locking door")
lockDoor()
button.on('interrupt', function (level) {
console.log("level: " + level + " locked: " + locked)
if (level == 0) {
if (locked) {
unlockDoor()
function PiIO() {
LinuxIO.call(this, {
name: 'Pi-IO',
pins: pins,
defaultI2cBus: 1,
defaultLed: 'LED0'
});
pigpio.initialize();
// After explicitly calling pigpio.initialize wait 100ms for pigpio to become
// ready for usage. This delay is necessary for alerts to function correctly.
// See https://github.com/joan2937/pigpio/issues/127
// Update: This issue was fixed with pigpio V63 in May 2017. When Raspbian is
// updated to include pigpio V63 the timeout here can be removed.
setTimeout(function () {
this.emit('connect');
this.emit('ready');
}.bind(this), 100);
}
util.inherits(PiIO, LinuxIO);