![]() |
Ok one problem
When creating my code for the Autonomous mode, i'm running into a problem with making a counter of some sort so i can change directions or perform actions during the mode. I thought i'd try setting up one like most other languages time = time + 1 << thats how i know how to do it, its plan and simple. I've not had too much experiene with PBASIC but there must be another way.
Also my if statments sorta go like this, are they the problem? if time < (a certain time) then do_a_turn do_a_turn: "turn code" if theres something wrong with that lemme know too. I'm probly doing something really dumb, but its a big problem we're having. thanks! |
Re: Ok one problem
Quote:
Code:
if time < (a certain time) then do_a_turn:Code:
if time >= (a certain time) then skip_turn:-Kesich |
assuming you want to use pbasic 2.0 syntax, the easiest way (that I have found) to keep everything straight is to do something like this:
Code:
if condition1 then do_condition1this would be equivilent to a nested if...else if...else if...else statement in C. |
PBASIC 2.5
If you are using PBASIC 2.5, then try using the select / case statements like so:
select (timer) case 0 to 300 'code to make robot go straight case 301 to 500 'turning code '.....etc endselect that way it will go to the section of code you want, and it stays neat, orderly, and you dont have to mess with a ton and a half of labels :cool: |
| All times are GMT -5. The time now is 05:05. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi