Created
March 7, 2014 14:02
-
-
Save andrewn/9412037 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wpi = require('./build/Release/wiringPi'); | |
wpi.wiringPiSetup(); | |
var colour = [255, 255, 0]; | |
var pins = [0, 2, 3 ]; | |
pins.forEach(createPwmPin); | |
setColour(colour); | |
function setColour(colours) { | |
colours.forEach(setPwmPin); | |
} | |
function setPwmPin(colourValue, pinIndex) { | |
wpi.softPwmWrite(pins[pinIndex], colourValue); | |
} | |
function createPwmPin(pinNum) { | |
wpi.softPwmCreate(pinNum, 255, 255); | |
} | |
// The programme quits now because everything's been done | |
// but it needs to stay running otherwise the lights go | |
// out. :-( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment