Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/node
- ////////////////////////////////////////
- // blinkLED.js
- // Blinks the USR LEDs and P9_14.
- // Wiring: P9_14 connects to the plus lead of an LED. The negative lead of the
- // LED goes to a 220 Ohm resistor. The other lead of the resistor goes
- // to ground.
- // Setup:
- // See:
- ////////////////////////////////////////
- const fs = require('fs');
- let LED1 = "/sys/class/leds/beaglebone:green:usr0/brightness";
- //const LED2 = "/sys/class/leds/beaglebone:green:usr1";
- //const LED3 = "/sys/class/leds/beaglebone:green:usr2";
- //const LED4 = "/sys/class/leds/beaglebone:green:usr3";
- //const LED5 = "/sys/class/leds/beaglebone:green:usr4";
- // var brightness = [ "/sys/class/leds/beaglebone:green:usr0/brightness", "/sys/class/leds/beaglebone:green:usr1/brightness",
- // "/sys/class/leds/beaglebone:green:usr2/brightness", "/sys/class/leds/beaglebone:green:usr3/brightness",
- // "/sys/class/leds/beaglebone:green:usr4/brightness" ];
- setInterval(perk, 10000);
- function perk() {
- while(1) {
- fs.writeFileSync(LED1, '1', function (err) {
- if (err) return console.log(err);
- console.log('1 > LED1');
- })
- fs.writeFileSync(LED1, '0', function (err) {
- if (err) return console.log(err);
- console.log('0 > LED1');
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement