My results are: dreverse = I can not make the bot take reverse more faster dforward = Works fine 100% totalhalt = Works fine 100% (To me... here the bot have to stop, wait a few seconds and then take reverse)
I have been reading several topics from some users.
just flipping bits high and low will always give you full speed as long as the Enable pins are tied high. If you are working with the Start Here Robot (it seems you are), the Enable pins are tied HIGH on the board (you don’t have a choice).
Your robot will not move any faster in reverse than it does now. I would think, if you are using the robot kit, the motors should move about the same speed forward or reverse. There may be a slight difference in velocity, but, nothing too worrisome.
Forward = So fast Reverse = Slow compared to forward Totalhalt… To me is like a forward but 50% slower
Therefore, if exists any method to do reverse more fast, I can replace Totalhalt with Reverse… Just if I can make Reverse faster. But I think will not happen… Am I right, Birdmun?
’ Drive and stop servo s.2, 150 symbol trig = b.0 ; Define output pin for Trigger pulse (M2, X2 parts). Change to port.pin you end up using. Note pin b.0 = s.3 symbol echo = b.5 ; Define input pin for Echo pulse (M2, X2 parts). Also note that on the IRS pin b.5 = s.5 as used with the SRF005 header/ULTRA command. symbol range = w1 ; 16 bit word variable for range main: pulsout trig,2 ; produce 20uS trigger pulse (must be minimum of 10uS) pulsin echo,1,range ; measures the range in 10uS steps pause 20 ; recharge period after ranging completes let range = range * 5 / 58 if range>20 then 'My Own Test sound S.12, (50, 20) 'One kind of sound, if something is far. gosub dforward elseif range>=10 AND range<=20 then sound S.12, (112, 10) gosub dreverse elseif range<10 then sound S.12, (80, 20) 'Another kind of sound, if something is close. gosub totalhalt
’ Drive and stop servo s.2, 150 symbol trig = b.0 ; Define output pin for Trigger pulse (M2, X2 parts). Change to port.pin you end up using. Note pin b.0 = s.3 symbol echo = b.5 ; Define input pin for Echo pulse (M2, X2 parts). Also note that on the IRS pin b.5 = s.5 as used with the SRF005 header/ULTRA command. symbol range = w1 ; 16 bit word variable for range main: pulsout trig,2 ; produce 20uS trigger pulse (must be minimum of 10uS) pulsin echo,1,range ; measures the range in 10uS steps pause 20 ; recharge period after ranging completes let range = range * 5 / 58 if range>20 then 'My Own Test sound S.12, (50, 20) 'One kind of sound, if something is far. gosub dforward elseif range>=10 AND range<=20 then sound S.12, (112, 10) gosub dreverse elseif range<10 then sound S.12, (80, 20) 'Another kind of sound, if something is close. gosub totalhalt
after debug you have gosub dforward and then goto main. Your robot will ALWAYS execute the forward command. If you are reversing or stopping, you do not want to go forward.
Why do you not use the port labels for your pins? Your chip has 4 ports A, B, C, and D. Each port has 8 pins 0-7. I may be wrong, but, it would seem to me that it would be easier to understand your code, if you called S.2 as B.2 and S.8/S.9 as C.0 and C.1 and S.12 as C.4. I am only beliving it is easier to read because the A-D ports are how I have seen them labeled. I have not before seen the S.x declaration.