Ragtop
08-31-2011, 05:17 PM
Thanks to octanetripledax I am trying to move the mouth of my halloween project in relation to audio that is being processed through a ADC.
repeat while routine < 90 'servo mouth action
routine++
if routine == 50
outa[barking] := 0 'give the pin a period of being on to trigger mp3 and reset to zero now
waitcnt(clkfreq/15 + cnt)
volume := ADC.getval(0)
case volume
30..46: mouthposition := 158 + (43-volume) 'closed
43..49: mouthposition := 155 'center
50..70: mouthposition := 155 - (2*(volume-49)) 'open
I know the servo is limited to how fast it can move from position to position, but at times it just seems locked up. The longer I make waitcnt(clkfreq/15 + cnt) the better it gets, but it still seems to not move as often as mouthposition is changing.
I am assuming because the servo is reading pulses, there has to be some time period between changing the pulse widths?
I am using a JrSport ST126MG at 6v.
repeat while routine < 90 'servo mouth action
routine++
if routine == 50
outa[barking] := 0 'give the pin a period of being on to trigger mp3 and reset to zero now
waitcnt(clkfreq/15 + cnt)
volume := ADC.getval(0)
case volume
30..46: mouthposition := 158 + (43-volume) 'closed
43..49: mouthposition := 155 'center
50..70: mouthposition := 155 - (2*(volume-49)) 'open
I know the servo is limited to how fast it can move from position to position, but at times it just seems locked up. The longer I make waitcnt(clkfreq/15 + cnt) the better it gets, but it still seems to not move as often as mouthposition is changing.
I am assuming because the servo is reading pulses, there has to be some time period between changing the pulse widths?
I am using a JrSport ST126MG at 6v.