Hi Guys. I can’t find the guy who helped me with my Iron Man programming so if anyone can help with 360 degree program that’d be awesome. .
I’ve been asked for the code for the Ironman helmet. Here it is. As I mentioned an acquaintance wrote this and I paid him for it. The servers had to run in mirror opposite directions but together because of how they were mounted.
[code]Connections
Channel 0 - Servo 1
Channel 1 - Servo 1
Channel 2 - Push Button Switch
Channel 3 - Eyes
Channel 4 - Arc Reactor
Operation
The start position is always “visor up, eyes and Arc reactor off ”
Press the button to run the servos to close the visor.
Visor closed “then” the Arc reactor lights up
then the lights in the eyes flicker a little then stay on.
Press the button again to run the servos to open the visor.
At the same time the lights in the eyes flicker a little then turn off.
Visor open
Then the Arc reactor turns off
This is the start position
Program
servo_reset
lights_off
servo_reset
main_loop
quit
servo control subroutines
sub servo_reset
#reset servos to mid position
500 delay
4000 4000 set_servos
return
sub servo_gate_open
#move servos in the opposite direction
500 delay
4000 8000 set_servos
return
sub servo_fin_right
#move both servos to the left
500 delay
8000 8000 set_servos
return
sub set_servos
#consume two stack values to run servos
1 servo 0 servo
return
Button stadfte read subroutines
sub button
2 get_position 511 less_than
return
sub wait_for_press
wait_open
wait_close
return
sub wait_open
get_ms
begin
button
if
drop get_ms
else
get_ms over minus 10 greater_than
if drop return endif
endif
repeat
return
sub wait_close
get_ms
begin
button
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat
return
light control
sub eyes_on
8000 3 servo
return
sub eyes_off
2000 3 servo
return
sub arc_on
8000 4 servo
return
sub arc_off
2000 4 servo
return
sub eyes_flicker
eyes_on
20 delay
eyes_off
180 delay
eyes_on
40 delay
eyes_off
160 delay
eyes_on
80 delay
eyes_off
120 delay
return
sub lights_off
arc_off
eyes_off
return
sub main_loop
#Test function: control light with a button
begin
wait_for_press
led_on
arc_on
1000 delay
servo_fin_right
500 delay
eyes_flicker
eyes_on
led_off
wait_for_press
led_on
eyes_off
500 delay
servo_reset
500 delay
arc_off
led_off
repeat
return[/code]