Hello Pololu board
I’m new to the site and new to Robotics
I have an Iron Man Helmet WIP build and am now looking at the electronics. I was thinking of running the eyes and Arc Reactor from a reed switch in the helmet but if I can get the Pololu Micro 6 to run it all that wpould be perfect
I’m not familiar with programming and only have 2 weeks to finish. I was wondering if someone more familiar with the Micro 6 and its programming would be willing to help me out.
If so, thanks a million and this is how I would like to set my helmet up like.
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 and stays on
then the lights in the eyes flicker a little then stay on.
Press the button again to run the servos to open the visor.
The the lights in the eyes flicker a little then turn off.
Then the Visor opens
Then the Arc reactor turns off
This is now back at the start position
Connection
Channel 0 - Servo 1
Channel 1 - Servo 2
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 reacto 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
hi i tried your code im using pololu micro copied n pasted code
using your set up nothing happens when i press the switch im using 2 servos mirrored
if i check servo 2 box face plate moves a little light flickers on if check servo 2 box again light goes off lol
im i doing somthing wrong ?
thanks for your help
tes
Just make these 2 sections the same. Make sure you save copies for testing
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
All the code is here with explanations. I can’t get into the "how’s and whys " as it was coded by a programmer guy I know. I don’t know anything about programming but I was able to change the speeds direction or the servo and the timing of the lights by paying around with the code. I made a test board for it
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 reacto 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