Let's Make Robots!

Help with 18x Electric Vehicle code

I'm working on some code for an event in Science Olmpiad in New york, the code below should check input 2 for a high signal, then jump to sub Diselect, then check for the pins for the right combonations of inputs to then jump to the assosiated sub, the subs take a plse input from an optointerupt and record the length of the pulse to w0, it wil pulse the servo until w0 is equal to the assigned number.



if input2=1 then Diselect
goto main

if input0=1 then _5

goto Diselect

pulsin 7,1,w0

pulsout 6, 100
loop until w0=50
goto main


where did I go wrong?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sorry, It has to go an unkown distance between 5 and 10 meters in .5 meter intervals and stop on a dime
Also some description of what it is actually doing may help too. you just tell us what it is supposed to do.

It might be that w0 does not get updated while the program is running the inner loop:

do ; loop until

After all, you only write to w0 at the pulsin command. You should give the Picaxe simulator a try.