Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ShawnHymel
Created February 11, 2016 23:05
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 ShawnHymel/81b642dcedd7b7266837 to your computer and use it in GitHub Desktop.
Save ShawnHymel/81b642dcedd7b7266837 to your computer and use it in GitHub Desktop.
Getting Started with Intel Edison - Part 7
var mraa = require('mraa');
var http = require('http');
var port = 4242;
var led = new mraa.Gpio(12, true, true);
led.dir(mraa.DIR_OUT);
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.write(" <!DOCTYPE html> \
<html> \
<head> \
<title>My Page</title> \
</head> \
<body> \
<p>This is my page. There are many like it.</p> \
</body> \
</html>");
res.end();
led.write(1);
setTimeout(function() {
led.write(0);
}, 500);
});
server.listen(port, function() {
console.log('Server listening on port ' + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment