jammincomedy
Posts: 8
Joined: Fri Aug 31, 2018 2:18 pm

Whoopee cushion project

Mon Oct 15, 2018 1:35 pm

Hello. Has anybody tried the Whoopee cushion project and not had the sound effects work when the circuit is completed? The code in Python is correct. And, the sound effects are in the correct folder that is being called in the Python code.

When typing in mkdir whoopee, the whoopee folder is put at the bottom of the folder list in the Pi directory. That is the folder that I put the sound effects in that is referenced in the Python code. The sound effects will work when tested in the terminal. But, touching the foil together on the plates won't produce a sound effect. I even tried it without the plates and sponges and just connected two pieces of foil together to complete the circuit that way.

I'm just wondering if anybody else had any trouble getting the sound effects to play via the Python program and what troubleshooting you might have done. Thanks.

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Whoopee cushion project

Mon Oct 15, 2018 1:44 pm

It's best to be clear about exactly which project you're talking so that users don't have to search or guess.
I assume you're talking about https://projects.raspberrypi.org/en/pro ... pi-cushion

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Whoopee cushion project

Mon Oct 15, 2018 1:57 pm

The sound effects will work when tested in the terminal. But, touching the foil together on the plates won't produce a sound effect. I even tried it without the plates and sponges and just connected two pieces of foil together to complete the circuit that way.
On the assumption that @DirkS has identified the right project you could troubleshoot by removing all the foil and sponges from the situation and try completing the circuit just by touching the two crocodile clips together.

And you could add a 'debugging' line to the script, before the os.system() line -

Code: Select all

    print("circuit complete")

jammincomedy
Posts: 8
Joined: Fri Aug 31, 2018 2:18 pm

Re: Whoopee cushion project

Mon Oct 15, 2018 4:52 pm

A fellow teacher suggested I move the pin on the left to the first one as that is pin 2, and that is what the 2 in the code stands for. Now, when I touch the foil together on the two plates, it shuts down the Raspberry Pi. I tried to move the power cord from the power strip to the wall to see if that would make a difference. But, it still shuts it down the Pi. Has anybody experienced this? Thanks again.

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Whoopee cushion project

Mon Oct 15, 2018 5:10 pm

Not sure which pins you are referring to... The '2' in the code stands for GPIO2 (GP2 in the tutorial picture), not for pin 2 which is 5V power.
Connecting 5V to ground would probably damage your Pi.

But I would try @BGoodes suggestion first: does it work when you touch the croc clips together?

If not then move the left lead from GP2 to e.g. GP17
You also need to change the code to

Code: Select all

button = Button(17)

jammincomedy
Posts: 8
Joined: Fri Aug 31, 2018 2:18 pm

Re: Whoopee cushion project

Mon Oct 15, 2018 6:58 pm

I got the entire project working on a different Pi. It first worked with the two crocodile clips connected and then worked with the whoopee cushion contraption. Very strange that it wouldn't work on the other one. Maybe I had a line of code wrong. Thank you.

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Whoopee cushion project

Mon Oct 15, 2018 7:25 pm

jammincomedy wrote:
Mon Oct 15, 2018 6:58 pm
Maybe I had a line of code wrong. Thank you.
Well, I actually suspected interference from other software.
GPIO2 is also used by i2c, and I don't know what happens if it's activated. That's why I suggested moving to GPIO17

Return to “Python”