Skip to content

Instantly share code, notes, and snippets.

@ShawnHymel ShawnHymel/main.js
Created Feb 11, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.