Created
April 18, 2015 01:06
-
-
Save KazukoShikiya/878ee36143b43133d1c5 to your computer and use it in GitHub Desktop.
Raspberry Pi and pi-blaster , Change PWM -sample??-
This file contains 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 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