Help with rocket launch controller build - Raspberry Pi Forums
i building rocket launch controller. far have launch sequence working when press 'button.' counts down 10 , fires correct led @ end of countdown. have key switch attached board though , want ot launch when key switch on. want led2 on if switch on , led3 on if switch off indicate 'armed' status of controller. know next nothing python , have scrapped code far several tutorials , others' builds of similar projects.
[mod edit - inserted code tags greater readability]
appreciated. thanks!
code: select all
from gpiozero import led, button time import sleep signal import pause subprocess import popen led = led(17) led2 = led(27) led3 = led(22) button = button(2) armswitch = button (4) led2.on() while true: button.wait_for_press() led2.off() print ('countdown sequence initializing. ignition in...') popen(["flite -t 'countdown sequence initializing. ignition in'"], shell=true) sleep(4) in range(0,10): print (10 - i) popen(["flite -t '" + str(10 - i) +"'"], shell=true) if (10 - i) < 3: led2.blink(on_time=.1, off_time=.1) elif (10 - i) < 6: led2.blink(on_time=.25, off_time=.25) else: led2.blink(on_time=.5) sleep (1) print ('ignition') popen(["flite -t 'ignition!'"], shell=true) print ('...') led.on() led2.on() led3.blink(on_time=.05, off_time=.05) sleep(2) led.off() led3.off() print ('sequence complete. disarm system before approaching launch pad.') popen(["flite -t 'sequence complete... disarm system before approaching launch pad.'"], shell=true) led2.on()
appreciated. thanks!
here's quick video update on project: http://youtu.be/lhmlllxe6da
working way want, when arm switch , countdown duration switch off (low) keep getting false (high) signals change countdown duration or arm system when it's suppose disarmed. i'll post new code in moment here , see if has suggestions. until check out video.
working way want, when arm switch , countdown duration switch off (low) keep getting false (high) signals change countdown duration or arm system when it's suppose disarmed. i'll post new code in moment here , see if has suggestions. until check out video.
raspberrypi
Comments
Post a Comment