Simple code

Im wanting to write a code to make my bot drive forward for a certain amount of time and turn to enter a specified place. Im not exactly sure where to start to make the bot drive for an amount of time that I designate. Help? Im using easyC.

Find a “Setmotor” block which i believe is under “Outputs” then drag it into the programming space and configure it properly to your motors (set port number and the direction that it needs to rotate). Do this for every motor you want to run.

Next, under “programming flow” there will be a block called “Wait” put this below all of the “Setmotor” blocks. Enter in the desired time you want the motors to run (It uses milliseconds so 1000=1 sec).

Then below the wait block put copies of the “Setmotor” blocks you started with. Except this time set the direction to “0”.

So this program will run the motors (which ever ones you set) for x seconds (however many you set) then after those seconds the motors will stop and nothing else will happen.

Thanks so much. I knew it was something simple and easy but for the life of me just could not wrap my head around it.