I have put together a system that consists of the micro maestro 6 channel, paired with the 5 cm distance sensor (also pololu brand). I have soldered the Vin to the + side of the servo power with the intention of running the whole board and servo off of one power supply. (see images)
I am powering everything via a 5 V 6 A power supply. The highish current is due to the servo being a 40 kgcm servo.
I programmed the board via the following script, which translates as i understand it to
read button a (which is the sensor)
if the button reads low, then run through sequence a, else loop
if the loop is activated then set change servo position from 6400 to 3200, hold for 6 seconds, then set servo position back to 6400 (the 3 delays of 2000ms was just me troubleshooting possible line timeouts, which was unsuccessful)
code follows:
begin
button_a if sequence_a endif
repeat
sub button_a
1 get_position 500 less_than
return
sub sequence_a
6400 0 servo 6 0 acceleration 1000 delay
3200 0 servo 2000 delay
2000 delay
2000 delay
6400 0 servo 3 0 acceleration 2000 delay
return
long story short, the code runs perfectly fine whilst plugged in via USB, however when i unplug the USB and run on internal storage, then the code terminates mid sequence, almost as if it encounters an error. i never get any error message on the error terminal when plugging back in either. Could this be because of me powering everything together from 1 power supply? I plan to have this running 24/7 as a dustbin open at home so that the servo connects via links to open the bin without me having to push any levers or lifting the lid myself