MMM-PIR-Sensor wont do anything



  • This is really bugging me! Ok, I am new to Pi programming but I have knowledge of a few programming languages and can usually tweak my head around problems but this has really stumped me!

    I turned the PIR sensor away from me to show no movement. When I use “sudo ./test.sh” I get a load of 0’s on the screen displaying no movement. When I wave my hand in front I get a load of 1’s. So its working correctly.

    I setup MMM-PIR-Sensor and change the pin from default to number 7 in the config file. Nothing happens on the screen. It doesn’t switch off when it senses no movement (like its supposed to)

    This is my test.sh code (which works):

    echo "4" > /sys/class/gpio/export
    echo "in" > /sys/class/gpio/gpio4/direction
    
    while true;  do
            trap 'echo "4" > /sys/class/gpio/unexport' 0
            stat=`cat /sys/class/gpio/gpio4/value`
            echo $stat
    
    done
    exit 0
    

    And my config code:

    {
    module: 'MMM-PIR-Sensor',
    config: {
    sensorPIN: 7 
    }
    },
    

    I just know its something simple but I am stumped!



  • @TS77UK said in MMM-PIR-Sensor wont do anything:

    echo “4” > /sys/class/gpio/export

    Ignore that! I was looking at the wrong pin map for my model Pi! I should have been in number 4 not 7! As soon as I typed it I realised the answer lol

    Thank you for your time