Ok, cheers. Will remember that one...
Posts by mesmer
-
-
I use notepad++ to get around the formating issues on windows. I have been using it for years and it has never let me down yet!
-
Hi to all. My knowledge of Linux, and writing code, is limited......so please bear with meI have built a simple 5v cooling fan for my Rasp Pi3 (yes, I know it doesn't really need one, but humour me!). It is to be switched via a NPN transistor to simply run at one speed from boot up. To do this, I need GPIO 24 to become active/high at boot up. This is for the base input of the transistor, the fan is powered from the 5v rail.
I'm trying to devise a script/code to add to LE, in order to set GPIO 24 pin 'High' or '1' on boot up.
I can acheive the basic function of getting the pin to go from Low/off to High/on by SSH'ing into LE and issuing the following commands at the terminal:Codeecho "24" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio24/direction echo "1" > /sys/class/gpio/gpio24/value
After a bit of looking about, I tried creating an 'autostart.sh' script (as per the wiki) and then adding the above code to it. The script is located at /storage/.config/autostart.sh
It fails to work at boot up (the file has maximum permissions '777', so should be executable), and if I try to run 'autostart.sh' at the terminal, it spits out several errors which roughly say:
Can't create
/sys/class/gpio/export
/sys/class/gpio/gpio24/direction
/sys/class/gpio/gpio24/valueSorry, I haven't got the exact output to hand at the moment, but that is very close.
So, can anyone tell me what I'm missing and doing wrong here, please?
Cheers.
UPDATE:
So, I got this to work eventually...........
It turns out that if you create an 'autostart.sh' file under a DOS/Windows environment, it doesn't format the file correctly. You need to do it within a UNIX environment - in other words, SSH into your Pi and create it using Nano editor. I originally created mine in windows and moved it onto my Pi via SSH.
'Chmod 755' gave sufficient permissions, as you login and create the autostart.sh as ROOT.
Not sure why this now works on boot, but I can't run the script in the SSH terminal...........that fails: 'autostart.sh not found'
Must be a path or permissions thing.So, the code works, and now the startup script works too; if that's of use to ya.
Incidentally, the GPIO 24 pin goes 'Low' or '0' when you reboot Kodi, so I guess no need to add a shutdown script to kill the fan. But you could very easily create one using the above code and minor changes - see autostart.sh page for 'shutdown.sh'
-
Hi to all. My knowledge of Linux, and writing code, is limited......so please bear with me
I have built a simple 5v cooling fan for my Rasp Pi3 (yes, I know it doesn't really need one, but humour me!). It is to be switched via a NPN transistor to simply run at one speed from boot up. To do this, I need GPIO 24 to become active/high at boot up. This is for the base input of the transistor, the fan is powered from the 5v rail.
I'm trying to devise a script/code to add to LE, in order to set GPIO 24 pin 'High' or '1' on boot up.
I can acheive the basic function of getting the pin to go from Low/off to High/on by SSH'ing into LE and issuing the following commands at the terminal:Codeecho "24" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio24/direction echo "1" > /sys/class/gpio/gpio24/value
After a bit of looking about, I tried creating an 'autostart.sh' script (as per the wiki) and then adding the above code to it. The script is located at /storage/.config/autostart.sh
It fails to work at boot up (the file has maximum permissions '777', so should be executable), and if I try to run 'autostart.sh' at the terminal, it spits out several errors which roughly say:
Can't create
/sys/class/gpio/export
/sys/class/gpio/gpio24/direction
/sys/class/gpio/gpio24/valueSorry, I haven't got the exact output to hand at the moment, but that is very close.
So, can anyone tell me what I'm missing and doing wrong here, please?
Cheers.