Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
'=========variables============= yservo var sword counter var sword counter = 0 ttime var bit ttime = 1 '=========maincode============= loopit: adin ax0,1,ad_ron,yservo if yservo < 700 then repeat counter = (counter - 25) servo p5, counter, ttime adin ax0,1,ad_ron,yservo until yservo > 700 elseif yservo > 710 repeat adin ax0,1,ad_ron,yservo counter = (counter + 25) servo p5, counter, ttime until yservo < 710 else gosub nothing endif goto loopit '===========subcommand============== nothing: pause 1 return
I haven't checked your source code, but remember, the signal must be sent 50 times per second (even if your pot - input, has not changed). Don't send the signal only when the input changes!
'=========variables=============yservo var swordcounter var swordcounter = 0ttime var bitttime = 1'=========maincode============= loopit:adin ax0,1,ad_ron,yservo if yservo < 700 then repeat counter = (counter - 25) servo p5, counter, ttime adin ax0,1,ad_ron,yservo until yservo > 700 elseif yservo > 710 repeat adin ax0,1,ad_ron,yservo counter = (counter + 25) servo p5, counter, ttime until yservo < 710 else gosub hold endifgoto loopit '===========subcommand============== hold: servo p5, counter, ttime return
The really cool thing about this program is that you can control a servos position by add or sub.