MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. Tags
    3. gpio
    Log in to post
    • All categories
    • sapblatt11

      Fixsandbox script not working, unable to run as root
      Troubleshooting • electron gpio pm2 root • • sapblatt11

      4
      0
      Votes
      4
      Posts
      350
      Views

      S

      my script turns off the need to run in sudo mode

      we should never run mm in sudo, or install w sudo

    • sranj

      LIRC AUTOMATION
      Development • automation coding gpio lirc pir python sensor • • sranj

      4
      0
      Votes
      4
      Posts
      296
      Views

      S

      @sranj ok, so u receive the trigger in the node_helper, and need to launch/exec/spawn your python pgm

      so you need the child_process library
      https://nodejs.org/en/knowledge/child-processes/how-to-spawn-a-child-process/

      PIR uses the same library to launch the tvservice command, or vgencmd to blank the screen

    • J

      Switch HDMI on/off by pressing button connected to GPIO.
      Troubleshooting • hdmi onoff button gpio noob • • JHermsen

      2
      0
      Votes
      2
      Posts
      1400
      Views

      P

      install the MMM-Admin module. It will serve up a webpage and you can control the HDMI from there…even use it on your phone. works well

    • paviro

      PIR-Sensor - put your mirror to sleep if not used
      System • utility gpio motion-sensor power-saving • • paviro

      56
      2
      Votes
      56
      Posts
      72917
      Views

      S

      @randomnoise said in PIR-Sensor - put your mirror to sleep if not used:

      exec(“xdotool key space”); //simulate spacebar to disable screensaver. Needs xdotool to be installed

      Hello Randomnoise;

      So you did exactly what I am looking to do. Can you elaborate on how to configure this so my PIR will turn off the screen saver? I’ve already installed Xdotool, but I don’t know where to go from there.

    • paviro

      SOLVED GPIO without root
      Development • gpio wiring-pi • • paviro

      4
      0
      Votes
      4
      Posts
      5520
      Views

      paviro

      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) } });
    • 1 / 1