Lightning button on the rear...?
Re: Lightning button on the rear...?
I found a small note in the installation guide...
“5 - V1.2 Has some difference :
Button with a lightning bolt at the back is now a GPIO button.”
So what can we do with the his GPIO button??
“5 - V1.2 Has some difference :
Button with a lightning bolt at the back is now a GPIO button.”
So what can we do with the his GPIO button??
Re: Lightning button on the rear...?
On v1.2 revision (second batch) devices it does nothing on default. But it is connected to one of the GPIO pins of raspberry (specifically GPIO 17) and it can be accessed from command line, through script or other programs. So in theory it can be used for anything and only your programming skills are the limit.
Most obvious use would be as shutdown or soft reset button, checked by bash script. But it might be programmed even as controller button.
Personally I intend to programm it as soft reset button and cut it flat with case to prevent accidental pushing. This would be great for those "stucked" situation where you don't have keyboard around to restore (typically "file manager" - this one is my personal nightmare). Only I have been too busy playing instead of programming
Most obvious use would be as shutdown or soft reset button, checked by bash script. But it might be programmed even as controller button.
Personally I intend to programm it as soft reset button and cut it flat with case to prevent accidental pushing. This would be great for those "stucked" situation where you don't have keyboard around to restore (typically "file manager" - this one is my personal nightmare). Only I have been too busy playing instead of programming
Re: Lightning button on the rear...?
Cheers for reply
I have tried using the program 'retrogame' to program the button but having followed the instructions, still cannot get it to simulate a keypress.
Fancy giving it it a go?
https://learn.adafruit.com/retro-gaming ... s-software
I have tried using the program 'retrogame' to program the button but having followed the instructions, still cannot get it to simulate a keypress.
Fancy giving it it a go?
https://learn.adafruit.com/retro-gaming ... s-software
Re: Lightning button on the rear...?
This Tutorial ist based on http://www.instructables.com/id/Simple- ... wn-Button/.
Download the script:
alternatively
edit the script:
replace
with
Set the Script to Run at Boot-up:
and write befor
the line
Don*t forget the & sign on the end, otherwise the Pi does hang in the bootprozess.
Download the script:
Code: Select all
wget http://tinyurl.com/off-button-py -O /home/pi/off-button.py
Code: Select all
wget https://www.instructables.com/files/orig/FVM/K0WJ/IA0WRZBF/FVMK0WJIA0WRZBF.py -O /home/pi/off-button.py
Code: Select all
nano /home/pi/off-button.py
Code: Select all
gpio_pin_number=YOUR_CHOSEN_GPIO_NUMBER_HERE
Code: Select all
gpio_pin_number=17
Code: Select all
sudo nano /etc/rc.local
Code: Select all
exit 0
Code: Select all
python /home/pi/off-button.py &
Re: Lightning button on the rear...?
Hi Thomas
Thanks for this!
Have tried the steps but no joy.
Have you tried this successfully?
Cheers
Thanks for this!
Have tried the steps but no joy.
Have you tried this successfully?
Cheers
Re: Lightning button on the rear...?
I followed this tutorial for a soft shutdown button https://www.youtube.com/watch?v=4nTuzIY0i3k
And I got it working with the following script (they used Pin 5, Lightning button uses Pin 11)
And I got it working with the following script (they used Pin 5, Lightning button uses Pin 11)
Code: Select all
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_UP)
oldButtonState1 = True
while True:
#grab the current button state
buttonState1 = GPIO.input(11)
# check to see if button has been pushed
if buttonState1 != oldButtonState1 and buttonState1 == False:
subprocess.call("shutdown -h now", shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
oldButtonState1 = buttonState1
time.sleep(.1)
Re: Lightning button on the rear...?
Thanks for this breeman
I have followed this to the letter and it still won't work for me!
Is it possible my BIB is not actually connected to ground/faulty?
I have tried this so many times now.
I have followed this to the letter and it still won't work for me!
Is it possible my BIB is not actually connected to ground/faulty?
I have tried this so many times now.
Re: Lightning button on the rear...?
Try to add instead of simply
Code: Select all
(sleep 10;python /home/pi/off-button.py) &
Code: Select all
python /home/pi/off-button.py &
Re: Lightning button on the rear...?
Thank you for your advice. Still no joy i'm afraid...Vilikt wrote:Try to addinstead of simplyCode: Select all
(sleep 10;python /home/pi/off-button.py) &
Code: Select all
python /home/pi/off-button.py &
BTW, what does 'sleep 10;' do to the code?
Re: Lightning button on the rear...?
Ok, so I rigged up an arcade button to my RPi3 to pins 5 & 6 and followed the tutorial by barryhubbard.
http://www.barryhubbard.com/raspberry-p ... io-button/
This works perfectly on my RPi3!
I followed the steps again for my Raspiboy and altered the script to Pin 11 and nothing.
Surely I have a dodgy PCB?
Edit: Have just tried a fresh clean install with a different SD on RetroPie 4.3 and same result.
http://www.barryhubbard.com/raspberry-p ... io-button/
This works perfectly on my RPi3!
I followed the steps again for my Raspiboy and altered the script to Pin 11 and nothing.
Surely I have a dodgy PCB?
Edit: Have just tried a fresh clean install with a different SD on RetroPie 4.3 and same result.