LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

Showing results for 
Search instead for 
Did you mean: 


Hi, I have finished the program in LabVIEW to manage robotic car using two touch sensors .

Program to do the following :

1 The Power variable holds the
current power level selected
by the user ( 0-100 ) . Start at 80

The variable holds TargetSteer
The steering motor angle That
the main sequence above is
Currently asking for , Which can
range from -75 ( left ) to 75 ( right ) .
Start at 0 for straight ahead .



2 If the Left Arrow button is bumped then subtract 20 from Power and write the new value back into power . If the value gets less than 20
then set it back to 20 with That 20 is the minimum allowed power . Confirm the button press with a beep .



3 If the Right Arrow button is bumped then add 20 to Power and write the new value back into power . If the value gets greater than 100
then set it back to 100 to 100 That is the minimum allowed power . Confirm the button press with a beep .



4 Display the current power on the screen before it and
some spaces after it to Ensure That the previous value is erased .



5 Test both touch sensors by doing and switch on sensor 1 , then resulting in both paths , and to switch on sensor 4 , Which results in four
possible paths Corresponding to the four button combinations ( both , left only , right only , neither ) . In each case , perform the action :

Both Pressed : TargetSteer Set to 0 ( straight ahead) and apply the selected power to both motors to go straight .

Left Pressed : Set TargetSteer to -75 (full left ) to send Power and Power C / 2 to B ( rear wheel power difference assists the steering )

Right Pressed : Set TargetSteer to 75 (full right ) , send it Power and Power B / 2 to B ( rear wheel power difference assists the steering )

Neither Pressed : TargetSteer Set to 0 ( straight ) and stop .


6.Get the current steering angle from its motor rotation sensor , then subtract That from
The Desired steering motor angle in TargetSteer , and use it That Determine how much
power and what direction to turn the steering motor to get to the Desired angle .
The power used is proportional to the angle difference , Which produces a smooth
progressive motion . The duration is Unlimited, with the power will just be briefly
updated , and then the loop will repeat and re -calculate a new power . As the steering
Desired approaches the angle , the power will reduce until it reaches 0 power at the
Desired steering and will stop there . If it overshoots , opposite power will bring it back .
The angle difference can be either positive or negative, with the motor direction is
Determined by testing to see if the difference is greater than zero or not , and the Motor
block 's Power port will take the absolute value of the power in wired .



Some of the steps and some do not know I certainly wrong. I am a beginner in labivew . Please find attached my program . Please help me with it .

Thank you

0 Kudos
Message 1 of 5

Hello Noro,


Is there a specific problem that you are having with the application? Have you identified if there's a part that is not doing what you expected? 


Best Regards,



0 Kudos
Message 2 of 5

Hi, I need to create a variable Subsequently That we can be changed and write to them new values. For example. I have left NXT Button, Which when pushed so I made some variable subtracted 20 and then added to the same variable, this value is then displayed on the NXT screen. But when you push the right button with this value is added to the value of 20 and entered again into the same variable. And this is repeated continuously. The current value is displayed on the screen of NXT. How do I solve? Through local variables?

Thank you for answering

0 Kudos
Message 3 of 5

Hi Noro,


Are you wanting the Right and Left button processes to be independent of each other? If you are updating the values in a while loop, I would recommend using shift registers to pass data between iterations.



Jordan G.

LabVIEW Product Marketing Engineer
National Instruments
0 Kudos
Message 4 of 5

This article is intended to control the direction and speed of a Lego NXT robot using the directional buttons on the computer keyboard, the remote control of limited strategic scope of the Bluetooth transmitter installed. I hope it will be useful, greetings

0 Kudos
Message 5 of 5