Skip to content

Instantly share code, notes, and snippets.

@KazukoShikiya
Created April 18, 2015 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KazukoShikiya/878ee36143b43133d1c5 to your computer and use it in GitHub Desktop.
Save KazukoShikiya/878ee36143b43133d1c5 to your computer and use it in GitHub Desktop.
Raspberry Pi and pi-blaster , Change PWM -sample??-
var http = require('http');
var url = require('url');
var piblaster = require('pi-blaster.js');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
var brightness = url.parse(req.url).pathname.slice(1);
if (brightness.length === 0 || isNaN(brightness)) {
res.end('hello? yes, this is pi!');
} else {
piblaster.setPwm(17, brightness / 100); // <- change PWM LED and Moter speed control
res.end('Brightness set to: ' + brightness + '%');
}
}).listen(1337);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment