BricxCC Motor Help

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
pesso
Posts: 8
Joined: 29 Sep 2010, 23:51
Location: Under your Bed

BricxCC Motor Help

Post by pesso »

This may sound like a really stupid question, but how to go forward until a variable is true?

--Pesso/Clen
51st Member Of MindBOARDS! (well, that's that the member's list says)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: BricxCC Motor Help

Post by mattallen37 »

What language? In NXC, I would do something like the following.

Code: Select all

int variable;

task main(){
  OnFwd(OUT_A,100);
  until(variable==1);
  Off(OUT_A);
}
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: BricxCC Motor Help

Post by afanofosc »

Something like what Matt posted except maybe you would want the variable value to actually be modified somewhere in your code. If you give us a bit more information about what you have in mind then we can make more specific suggestions.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
pesso
Posts: 8
Joined: 29 Sep 2010, 23:51
Location: Under your Bed

Re: BricxCC Motor Help

Post by pesso »

Thanks! You guys are awesome!

All I was doing was going forward until the US sensor > 6.

And BTW, I am using NXC.

- -pesclen
51st Member Of MindBOARDS! (well, that's that the member's list says)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests