Go to advanced search

by snielsen
Wed Jan 24, 2018 12:15 pm
Forum: Beginners
Topic: GPIOoutput from Rpi to another Rpi GPIOinput
Replies: 11
Views: 992

Re: GPIOoutput from Rpi to another Rpi GPIOinput

Thanks a lot, everyone! My problem is solved. I have inverted the 0 and 1 in GPIO.output(2, x) at line 6, 16 and 18 in the script running on Rpi nr 1. import RPi.GPIO as GPIO GPIO.setwarnings(False) from time import sleep GPIO.setmode(GPIO.BCM) GPIO.setup(2, GPIO.OUT) GPIO.output(2, 1) import simple...
by snielsen
Sun Jan 21, 2018 6:40 pm
Forum: Beginners
Topic: GPIOoutput from Rpi to another Rpi GPIOinput
Replies: 11
Views: 992

Re: GPIOoutput from Rpi to another Rpi GPIOinput

I still dont understand why the script seems to work well when testing only with LED, and do not work when I connect it to gpio 17 on the second rpi ( playback starts imedeately when jumpers are connected, before pressing input button on main rpi).
by snielsen
Sat Jan 20, 2018 9:22 pm
Forum: Beginners
Topic: GPIOoutput from Rpi to another Rpi GPIOinput
Replies: 11
Views: 992

Re: GPIOoutput from Rpi to another Rpi GPIOinput

The LED gives a short flash(0.1), and yes, it seems to work. But I did not have patience to wait for other resistors, so I connected the second Rpi where the wav file starts playing just by pressing F5 on keyboard, without Buttonpress on main Rpi ... strange to me :|
by snielsen
Sat Jan 20, 2018 8:58 pm
Forum: Beginners
Topic: GPIOoutput from Rpi to another Rpi GPIOinput
Replies: 11
Views: 992

Re: GPIOoutput from Rpi to another Rpi GPIOinput

Thanks a lot guys! by boyoh » Sat Jan 20, 2018 12:16 am Sugest switching the O/P between I/P of the Pi, you use a Opto Isolator No need to common the grounds, This will give electrical and noise isolation. Yes, it sounds resonable to consider this solution if it eliminates noise etc... if I understa...
by snielsen
Fri Jan 19, 2018 3:40 pm
Forum: Beginners
Topic: GPIOoutput from Rpi to another Rpi GPIOinput
Replies: 11
Views: 992

GPIOoutput from Rpi to another Rpi GPIOinput

Hello, Im trying to use this script to activate playback on a second Rpi. When button is pressed playback starts on the main Rpi, and the GPIO.output14 goes to a GPIO on the second Rpi. The problem is that the sound on the second Rpi starts without pressing button. I expected the GPIO 14 to be set a...
by snielsen
Fri Jan 19, 2018 10:08 am
Forum: General discussion
Topic: finally block - syntax error
Replies: 4
Views: 609

Re: finally block - syntax error

import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) GPIO.setup(27, GPIO.OUT) import simpleaudio as sa import time from gpiozero import Button button = Button(17) while True: if button.is_pressed: GPIO.output(27, 1) wave_obj = sa.WaveObject.from_wave_file('samples/test3.wav') play_...
by snielsen
Fri Jan 19, 2018 9:59 am
Forum: General discussion
Topic: finally block - syntax error
Replies: 4
Views: 609

finally block - syntax error

I am planning to use this code to play a sound on the "mother Rpi" where the button connected to GPIO 17 also will activate two other Rpis through GPIO.OUT. Without using the command GPIO.cleanup() at last, I get this message in the shell: Warning (from warnings module): File "/home/pi/gpio-music-bo...
by snielsen
Wed Jan 17, 2018 3:45 pm
Forum: Python
Topic: How to disable GPIO button when scriptis running
Replies: 10
Views: 1428

Re: How to disable GPIO button when scriptis running

Thanks a lot for helping me out! I also got rid of the clicking noise when the sound is starting. I will try to learn this from the beginning when there is more time :-)
by snielsen
Wed Jan 17, 2018 2:04 pm
Forum: Python
Topic: How to disable GPIO button when scriptis running
Replies: 10
Views: 1428

Re: How to disable GPIO button when scriptis running

Yes, actually I just put it like that too, but then there is a problem with attributes:

Traceback (most recent call last):
File "/home/pi/gpio-music-box/fra hjelper 01.py", line 13, in <module>
play_obj.wait_done()
AttributeError: 'function' object has no attribute 'wait_done'
by snielsen
Wed Jan 17, 2018 1:39 pm
Forum: Python
Topic: How to disable GPIO button when scriptis running
Replies: 10
Views: 1428

Re: How to disable GPIO button when scriptis running

Thanks a lot! I`m trying to run it but get Syntax error - expected an intended block. "wave_obj" is highlighted, I`ve tried diferent spacings around that ... as you understand I`m a beginner
by snielsen
Wed Jan 17, 2018 10:47 am
Forum: Python
Topic: How to disable GPIO button when scriptis running
Replies: 10
Views: 1428

How to disable GPIO button when scriptis running

Hello all! This is for use in an exhibition space, and I am searching around for a method to disable the button (17) as long as the script is running, to avoid several paralell playback`s when the audience are passing the motion sensor. Here is my script so far: import simpleaudio as sa from gpiozer...

Go to advanced search