Go to advanced search

by r4v3r23
Wed Apr 08, 2020 7:10 pm
Forum: Arch
Topic: RPi.GPIO on Manjaro
Replies: 2
Views: 374

Re: RPi.GPIO on Manjaro

solution:

sudo pacman -S python-pip
pacman -S python python-pip base-devel
pip install RPi.GPIO
by r4v3r23
Wed Apr 08, 2020 6:50 pm
Forum: Arch
Topic: RPi.GPIO on Manjaro
Replies: 2
Views: 374

RPi.GPIO on Manjaro

Im having an issue installing RPi.GPIO on Manjaro.

'sudo pip install RPi.GPIO' leads to errors and installing the pacman version doesnt do anything.
by r4v3r23
Wed Feb 26, 2020 3:32 pm
Forum: General discussion
Topic: 5V/3A Power Bank for RPi4
Replies: 5
Views: 291

Re: 5V/3A Power Bank for RPi4

Looking for a stable power bank to power my Pi4. This one fits the recommended specs: https://www.amazon.com/gp/product/B07SQ5MQ6K/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1 Is there anything else I should consider? Perhaps consider that the device in question is being advertised as suitable ...
by r4v3r23
Wed Feb 26, 2020 3:03 pm
Forum: General discussion
Topic: 5V/3A Power Bank for RPi4
Replies: 5
Views: 291

5V/3A Power Bank for RPi4

Looking for a stable power bank to power my Pi4. This one fits the recommended specs:

https://www.amazon.com/gp/product/B07SQ ... UTF8&psc=1

Is there anything else I should consider?
by r4v3r23
Fri Jan 24, 2020 6:39 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

pcmanbob wrote:
Fri Jan 24, 2020 3:41 pm
I would suggest using the full path in the line

Code: Select all

os.system('./script.sh')  
So if your script.sh file is located in the /home/pi directory your line would look like this

Code: Select all

os.system('/home/pi/script.sh')  
need this for it to run as service. thanks!
by r4v3r23
Fri Jan 24, 2020 4:53 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

just tried your original script and its running like it should! last question: i want to write a script that runs a shell script when the button is pressed. is this code correct? import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)...
by r4v3r23
Fri Jan 24, 2020 3:26 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

just tried your original script and its running like it should! last question: i want to write a script that runs a shell script when the button is pressed. is this code correct? import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP) ...
by r4v3r23
Fri Jan 24, 2020 3:24 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

Does you button actually work? Have you got a multi-meter? ok so i just redid the connection and got this: 10:22:49.052 1 pressed 10:22:49.102 1 pressed 10:22:49.152 1 pressed 10:22:49.203 1 pressed 10:22:49.253 1 pressed 10:22:49.303 1 pressed 10:22:49.354 0 10:22:49.404 0 10:22:49.454 0 10:22:49....
by r4v3r23
Fri Jan 24, 2020 3:11 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

rpiMike wrote:
Fri Jan 24, 2020 3:10 pm
And what happens when you press the button?
nothing
by r4v3r23
Fri Jan 24, 2020 3:07 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

Sounds like your button may be push-to-open. Try the following: import RPi.GPIO as GPIO,time,os,datetime GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP) while True: i = GPIO.input(24) print(datetime.datetime.now().strftime('%H:%M:%S.%f')[:-3],i) if i == GPIO.HIGH: print('...
by r4v3r23
Fri Jan 24, 2020 2:48 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

Is your button push-to-close or push-to-open? Why does it have to be on Manjaro? If working correctly that code should print nothing when the button is not pressed and print 'pressed' repeatedly when the button is pressed. my set up requires manjaro so its script is telling me that: 1) GPIO works &...
by r4v3r23
Fri Jan 24, 2020 2:44 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

davidcoton wrote:
Fri Jan 24, 2020 2:32 pm
And with the button disconnected?
terminal just hangs as if waiting for input, same response as when I had wrong GPIO number in code
by r4v3r23
Fri Jan 24, 2020 2:01 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

davidcoton wrote:
Fri Jan 24, 2020 1:38 pm
Get it saying "Pressed" repeatedly. Then press and hold the button. Any change?
No change it keeps printing "pressed"
by r4v3r23
Fri Jan 24, 2020 1:06 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

joan wrote:
Fri Jan 24, 2020 12:49 pm
We don't know what code is being used. We don't know how the switch is connected. The question is pointless.
both a photo of the connection & the code used are in this thread
by r4v3r23
Fri Jan 24, 2020 12:59 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

From the error message it looks like you changed 24 to 18. Do you understand the difference between physical pin numbers (BOARD) and BCM GPIO pin numbers. https://pinout.xyz/ changed to 24, get this output: pressed pressed pressed pressed pressed ad nauseum Is that with your button connected betwee...
by r4v3r23
Fri Jan 24, 2020 12:12 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

Try running my code. As joan mentioned physical pin 18 is BCM GPIO 24. Is your Raspbian Buster fully updated? this is running your code. im running Manjaro Minimal & installed rpi-gpio packages From the error message it looks like you changed 24 to 18. Do you understand the difference between physi...
by r4v3r23
Fri Jan 24, 2020 1:08 am
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

DougieLawson wrote:
Fri Jan 24, 2020 12:51 am
RPi.GPIO is only supported on Raspbian. You'll need to pull the source package and hack it to work on your alien operating system.
it already is maintained on manjaro
by r4v3r23
Fri Jan 24, 2020 12:32 am
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

Please edit your post and place your code in code tags. You should not need 'sudo' before 'python'. Replace your os.system with a print statement until it works. Add a photo of your wiring. (Many post image to imgur.com and link into post). Are you sure you've got the correct pin? https://pinout.xy...
by r4v3r23
Thu Jan 23, 2020 11:32 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

If your pulling a GPIO input up, the input will normally be High and you need to test for Low: import RPi.GPIO as GPIO,time,os GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP) while True: if GPIO.input(24) == GPIO.LOW: print('pressed') time.sleep(0.05) This tests fine for ...
by r4v3r23
Thu Jan 23, 2020 10:44 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

If your pulling a GPIO input up, the input will normally be High and you need to test for Low: import RPi.GPIO as GPIO,time,os GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP) while True: if GPIO.input(24) == GPIO.LOW: print('pressed') time.sleep(0.05) This tests fine for ...
by r4v3r23
Thu Jan 23, 2020 7:14 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

heres another test scripts that gives me the same hanging result: Meaning it runs and awaits a button press which it never detects? Where, specifically, is your button/switch connected? (As already suggested, an in-focus photo might help... ) imgur.com/a/cjVf5PY yes, it never detects the button pre...
by r4v3r23
Thu Jan 23, 2020 6:49 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

Please edit your post and place your code in code tags. You should not need 'sudo' before 'python'. Replace your os.system with a print statement until it works. Add a photo of your wiring. (Many post image to imgur.com and link into post). Are you sure you've got the correct pin? https://pinout.xy...
by r4v3r23
Thu Jan 23, 2020 6:47 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

Re: GPIO help

import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(23, GPIO.IN) while True: if GPIO.input(23): os.system("sudo shutdown -h now") prev_input = input time.sleep(0.05) (put that in code tags for you, as the forum removes leading indents) You haven't mentioned any pull-ups....
by r4v3r23
Thu Jan 23, 2020 2:48 pm
Forum: Python
Topic: [SOLVED] GPIO help
Replies: 38
Views: 1414

[SOLVED] GPIO help

so ive connected a button to GPIO 23 & GROUND and setup a python script to execute a shell script when button is pressed problem is the button press isnt being recognized by the python script. 'sudo python xxxx.py' hangs terminal. heres a test script: import RPi.GPIO as GPIO import time import os GP...

Go to advanced search