Wed Jan 30, 2013 10:28 pm
Right! 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
import time
#Which numbering system to use (Here, Physical pin number i.e. 7th pin, not Broadcomm names)
GPIO.setmode(GPIO.BOARD)
#Tell program which GPIOs are going to be used
GPIO.setup(7, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
#Sequence of events
while True:
GPIO.output(7, True)
time.sleep(1)
GPIO.output(12, True)
time.sleep(1)
GPIO.output(15, True)
time.sleep(1)
GPIO.output(7, True)
time.sleep(1)
GPIO.output(12, True)
time.sleep(1)
GPIO.output(15, True)
time.sleep(1)
#Reutn GPIOs to standard states
GPIO.cleanup()
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?
Thanks!