You don't have to use Python to program the Pi's GPIO. It's supported by C, BASIC, Shells, Pascal, Perl, PHP, Ruby and probably many others...JoshuaLewis1809 wrote:Hi!
My mate and I are in a band, and will be performing Omen by The Prodigy in our school battle of the bands. We thought it'd be really cool to get the Pi to play the glokenspiel in the song. So we have 3 solenoids to play three notes, wire, stripboard, resistors, transistors, springs for the solenoids to return to normal position(?), diodes, and a 12v power supply that we have to taken the end off of so there's just bare wire.
I assume ill have to write a python script thing to do this.
Anyone got any coding/circuit suggestions? My mate and I are AS Physics standard electronics, so were not too awful (ha)
Thanks for your time, anything you have to say would be valuable!
I would recommend Python if you are a python programmer. I'm a C programmer (mostly), so I would recommend C.JoshuaLewis1809 wrote:yeah i did see that! but I swear we thought of it without seeing that first haha.
hmm, well would you not recommend python? seems like the easiest way of doing it
and also, I don't think the circuit will be particularly difficult, just not too sure as which pins to attach the negative terminal wire to - ground or the 0V pin. well have three of these, so i dont know where the other two would go...
Code: Select all
GPIO.output(7, True) time.sleep(1) GPIO.output(12, True) time.sleep(1)
Code: Select all
GPIO.output(7, True) time.sleep(1) GPIO.output(7,False) GPIO.output(12, True) time.sleep(1) GPIO.output(12,False)
You are unlikely to get an answer as JoshuaLewis1809 has not been on the forum since 01 Feb 2013, 21:43
HiJoshuaLewis1809 wrote: ↑Wed Jan 30, 2013 10:28 pmRight! The circuit works on its own! we us a 9V battery in place of the pi's gpio for testing purposes and the solenoids work and hit the glokenspiel.
Now, for the coding:
Here's what I've done as the foundations, I just need to get the timings right to match the song, ill do that in my own time
BTW, this isnt actually what the solenoids will do on sunday, I just used these timings to test with
#Set up program
import RPi.GPIO as GPIO
#Which numbering system to use (Here, Physical pin number i.e. 7th pin, not Broadcomm names)
#Tell program which GPIOs are going to be used
#Sequence of events
#Reutn GPIOs to standard states
So that program will play the 3 notes/3 solenoids twice each in theory with a one second gap between
I cannot test this for a couple of days as I need GPIO compatible wire! Ugh
Anyway, some questions if you wouldnt mind helping me
How long does gpio.output(x, true), last for? I mean, how long is a voltage applied from gpio x?
WHERE CAN I FIND SOME WIRE THAT SAFELY WORKS WITH GPIO instead of poking LED's at the pins!
Is there any other python wizardry anyone can recommend to me for this?