A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
  • GPIO without root

    Solved gpio wiring-pi
    4
    0 Votes
    4 Posts
    6k Views
    paviroP
    Found a workaround! Use the shell within node to export the pins. Works without root if the user is added to the gpio group, to do that execute sudo useradd -g pi gpio. Setup the pins const exec = require('child_process').exec; exec("echo '22' > /sys/class/gpio/export", null); exec("echo 'in' > /sys/class/gpio/gpio22/direction", null); exec("echo '17' > /sys/class/gpio/export", null); exec("echo 'out' > /sys/class/gpio/gpio17/direction", null); Control the pins gpio.setup('sys'); gpio.wiringPiISR(22, gpio.INT_EDGE_BOTH, function(delta) { if (gpio.digitalRead(22) == 1) { console.log("High"); gpio.digitalWrite(17, 1) } else if (gpio.digitalRead(22) == 0) { console.log("Low"); gpio.digitalWrite(17, 0) } });
  • Usind date from one module to another

    core
    5
    0 Votes
    5 Posts
    4k Views
    paviroP
    Well that’s true :/