Skip to content

Instantly share code, notes, and snippets.

@misza222
misza222 / drive_led_with_button.js
Created March 3, 2014 17:23
Driving LED on Intel Galileo with push button
var fs = require('fs');
var button_gpio = 17; // maps to digital PIN5 on the board
var led_gpio = 27; // maps to digital PIN7
var fileOptions = {encoding: 'ascii'};
var exportGpio = function(gpio_nr) {
fs.writeFile('/sys/class/gpio/export', gpio_nr, fileOptions, function (err) {
if (err) { console.log("Couldn't export %d, probably already exported.", gpio_nr); }