A Step by Step Guide for Beginners on User Defined BAPI Creation - ABAP Development
LVEE Beginners User Guide
-
Upload
aravindlean -
Category
Documents
-
view
245 -
download
0
Transcript of LVEE Beginners User Guide
-
8/8/2019 LVEE Beginners User Guide
1/44
This User Guide is in Beta Test form. Please feel free to use it as is, and to make comments on the
effectiveness of this guide. The intention is to construct a functional document that can help new users of
the LabVIEW Education Edition programming software.
Cheers,T. Jump
-
8/8/2019 LVEE Beginners User Guide
2/44
LVEE
Vocabulary
Autonomous
Block diagram
Code
Compile
Download
Direct mode
Front panel
Remote modeVirtual Instrument (VI)
Materials
Each student:
Engineers Journalw/worksheet pages
Each student group:
Challenge
Building Guide*
Programming Guide
LEGO MINDSTORMSkit
Computer withLabVIEW EducationEdition
Introduction
Introduction
LabVIEW is a programming language that uses graphics insteadof text to create computer programs. With LabVIEW you cancreate games for kids, math programs for teaching high schoolstudents, and advanced applications to control laboratoryexperiments and display results. You can also use LabVIEW tocontrol robots.
The LabVIEW Education Edition (LVEE) incorporates specialfunctions for interfacing with the LEGO NXT controller. This guideis designed to help beginners get started with LVEE and begin to
explore the world of programming robots with LabVIEW.
Copyright 2009 Timothy E. Jump 1
-
8/8/2019 LVEE Beginners User Guide
3/44
The NXT also has a series of buttons that allow for
running programs and viewing data captured by the
NXT.
LVEE Introduction
Copyright 2009 Timothy E. Jump 2
As mentioned above, LVEE has built in functions to interface withthe LEGO NXT controller. The LEGO NXT controller (or brick) isessentially a small computer (microcontroller) that is an integratedcomponent in the LEGO MINDSTORMS and PITSCO Tetrix kits,and is used to interact with motors and sensors to control robotsbuilt with these systems.
The NXT brick has 3 output ports (A, B, C) on the top where
motors are attached, and 4 input ports (1, 2, 3, 4) on the bottom
where sensors are attached.
Hardware Tip
There is a rotation
sensor built into the
motors of the LEGO
NXT MINDSTORMS
kit. This embedded
rotation sensor does
not plug into the input
ports of the NXT (ports
1, 2, 3, or 4) but are
controlled through the
output ports (ports A, B
and C).
-
8/8/2019 LVEE Beginners User Guide
4/44
In order to program the NXT with LabVIEW, LVEE must be
installed on a host computer that can then communicate with theNXT over a USB cable or via Bluetooth. Once a program to
control the NXT has been written (with LVEE on the host
computer) the program can be executed in either direct or remote
mode. In direct mode, the program executes on the computer
and the computer controls the NXT. In remote mode, the
program is compiled and then downloaded to the NXT where
the NXT executes the program.
LVEE Introduction
Copyright 2009 Timothy E. Jump 3
Introduction Tip
You can think of direct
mode as the computer
being the brain and
remote mode as the
NXT brick being the
brain.
Programs in remote
mode take less time to
execute than programs
in direct mode because
information does not
need to be sent backand forth between the
computer and the NXT
brick. For this reason
you will want to execute
most of your programs in
remote mode.
Direct mode is useful for
debugging a program
because you can display
output values to the front
panel. You can also plot
sensor values on thefront panel in real time.
-
8/8/2019 LVEE Beginners User Guide
5/44
If you have not done so, load LVEE on to your computer. Once
loaded, access LVEE by clicking on the National InstrumentsMeasurement & Automation icon that should have loaded on your
computer desktop.
LVEE Set-Up
Copyright 2009 Timothy E. Jump 4
Set-Up Tip
A simpler process for
accessing LVEE is to
select START (bottom
left of your computer
screen if you are using
Windows), then select
All Programs, then
select National
Instruments, then select
LabVIEW 2009.
You should now be able
to see the LabVIEWicon.
Once you click the NI icon the following window will appear.
Expand the Software menu found in the panel to right by
selecting the + sign next to Software.
Right click on the icon
and select Send To. Now
select Desktop (create
shortcut) and this will
place this shortcut icon
on your desktop. Now
you can get to LVEE
directly.
-
8/8/2019 LVEE Beginners User Guide
6/44
LVEE Set-Up
Copyright 2009 Timothy E. Jump 5
Set-Up Tip
Once the Software menu is expanded you should see thefollowing screen. Now select LabVIEW 2009.
-
8/8/2019 LVEE Beginners User Guide
7/44
Now select Launch LabVIEW 2009 from the top of the new
window that now shows.
LVEE Set-Up
Copyright 2009 Timothy E. Jump 6
Set-Up Tip
Launch LabVIEW gets
you to the same window
as using the LabVIEW
shortcut created using
the Programming Tip
from page 4.
If you have not done so, read over the Programming Tips in the
sidebar starting at page 4. This will lead you to a process of
creating a shortcut to Launch LabVIEW EE from an icon on your
computer desktop.
-
8/8/2019 LVEE Beginners User Guide
8/44
The window shown below will now appear. Select Launch LabVIEW
to enter the LVEE programming interface.
LabVIEW EE Opening Window
LVEE Set-Up
Copyright 2009 Timothy E. Jump 7
Set-Up Tip
If you want LVEE to
launch direct from your
computer desktop and
bypass this final window
select the Do not show
this dialog again check
box in the lower left
corner.
Now, every time you
click on
LVEE will launch directly
into the programming
area of the IDE.
*IDE Integrated
Development
Environment
-
8/8/2019 LVEE Beginners User Guide
9/44
Now that LVEE is open there are several key areas to which you
should become familiar.
The selections on the right
each point to differentresources for seeking help
with LVEE.
Blank VI and BlankVI Targeted to NXTare the options forstarting new oraccessing existingVIs.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 8
Familiarize Tip
Programs written in
LabVIEW are called
virtual instruments
(VI).
Front Panel
-
8/8/2019 LVEE Beginners User Guide
10/44
For learning to use LVEE with the NXT, the Using the NXT Module
link is a good resource.
Once you open the Using the NXT Module section you will
see multiple categories (on the left) to support you in learning
to use LVEE.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 9
Familiarize Tip
Front Panel
-
8/8/2019 LVEE Beginners User Guide
11/44
Here is a close-up look at the help categories inside Using the NXT
Module.
The first two pages give general information and point to
some selected resources.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 10
Familiarize Tip
Expanding the Using Help section gives access
to information about how to use the Using the NXT Module
help guide.
-
8/8/2019 LVEE Beginners User Guide
12/44
Once you are ready to explore the use of more complex functions inLVEE, the remainder of the Using the NXT Module section offersexplanations and instructions to get you on your way.
Expanding NXT Module Basics gives access
to explanations of basic LVEE structures.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 11
Familiarize Tip
Take some time to
expand the different
guide sections and
explore the various
topics covered.
If you have experience programming the LEGO NXT
controller with either the LEGO MINDSTORMS NXT software
or RoboLab, accessing Migrating from Other Languages
will lead you through correlations between your previous
language and LVEE.
-
8/8/2019 LVEE Beginners User Guide
13/44
Now lets look at the programming environment of LVEE. Access
the Blank VI Targeted at NXT.
You should see two windows appear.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 12
Familiarize Tip
Front Panel
-
8/8/2019 LVEE Beginners User Guide
14/44
The grey window is called the Front Panel.
The Front Panel is where human interface controls are assembled
and set up for ease of human control of a robot.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 13
Familiarize Tip
Control for robots can be
either autonomous
(where the computer
controls the robot) or
teleoperative (where
humans control the
robot). In order for
humans to control robots
they must have access to
control devices such as
buttons, switches,
gauges and such.
Here is an example of aFront Panel with a buttonto turn on/off a motor, anLED to show when themotor is on/off and agauge to display themotors speed.
Front Panel
Front Panel
-
8/8/2019 LVEE Beginners User Guide
15/44
-
8/8/2019 LVEE Beginners User Guide
16/44
Both the Front Panel and Block Diagram share almost identicaltoolbars.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 15
Familiarize Tip
Note the hot-key
patterns given for
certain menu functions
Remove Broken Wires
is a great shortcut to
clear up wiring errors
that may be otherwise
difficult to identify.
Find and Replace is a
great function forswapping out elements
in your program. Say
you have a light sensor
and you want to replace
it with a touch sensor.
Rather than going into
the program, deleting
the light sensor,
dragging in the touch
sensor, then repairing
all the wiring you can
simply highlight the light
sensor and go into Findand Replace and
navigate to the touch
sensor and select it.
The drop-down menu and menu listings are identical. Selections that are
most useful for beginning programmers are:
File Where you can find the Open,
Save and Print functions as well as
where to start a new VI.
Edit Where you can find Undo,
Redo, Cut, Copy, Paste. More
importantly, here you can find critical
functions such as Remove Broken
Wires and Find and Replace.
-
8/8/2019 LVEE Beginners User Guide
17/44
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 16
Familiarize Tip
View on the Block
Diagram will give you
access to the
Functions Palette.
View on the Front
Panel will give you
access to the Controls
Palette.
Window on the Block
Diagram will give
access to the Front
Panel.
Window on the Front
Panel will give access
to the Block Diagram.
Show Context Help is
a window that will
describe and give
examples of how to use
any programming
element the cursor
hovers over .
View Gets you access to
the palettes necessary for
writing programs.
Controls Palette
Functions Palette
Tools Palette
Window Where you can
get access to Front Panel
and Block Diagrams you
have open (i.e. all the
programs you have open atthe time).
Help Where you can get
directly into NXT Module
Help, and where to activate
Show Context Help.
-
8/8/2019 LVEE Beginners User Guide
18/44
The graphical toolbars give access to Run programs as well as toDebugging Tools and options for cleaning up/neatly organizingcode.
As your experience with LVEE grows you will find greater value inthe tools available on the graphical toolbar.
* We will explore graphical toolbar items as we need them.
Now lets look at an example program and explore the steps towriting a program in LVEE.
LVEE Getting Familiar
Copyright 2009 Timothy E. Jump 17
Familiarize Tip
Allow the cursor to hover
over the different buttons
on the graphical toolbars
to see what each button
will do.
The example program at
right has a robot follow a
line with one light sensor
while searching for any
crossing lines with a
second light sensor. Line
following is accomplished
by alternating motors
on/off based on whether
the light sensor sees
white or black.
-
8/8/2019 LVEE Beginners User Guide
19/44
We will start learning to program in LVEE by first looking at thevisible elements of the example program.
Motor On (All Motors On) (Functions Palette/NXT IO/Complete/ Motors/Motor On)
Light Sensor on Port 2 looking for a light levelGreater Than (>) 45 (Functions Palette/NXT IO/Complete/Sensors/Read Light (LED On))
(Functions Palette/NXT IO/Complete/Sensors/Sensor Port)
(Functions Palette/NXT Programming/Comparison/Greater Than)
(Functions Palette/NXT Programming/Numeric/Numeric Constant)
Light Sensor on Port 3 looking for a light levelGreater Than (>) 45 (Functions Palette/NXT IO/Complete/Sensors/Read Light (LED On))
(Functions Palette/NXT IO/Complete/Sensors/Sensor Port)
(Functions Palette/NXT Programming/Comparison/Greater Than)
(Functions Palette/NXT Programming/Numeric/Numeric Constant)
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 18
Programming Tip
Take some time to start
recognizing the look of
different control
structures.
Example: The
beginning/end arrow on a
loop.
Under the Functions
Palette/NXT IO there are
direct links to Motors and
Sensors (among other
items) rather than going
through Complete.
These direct pathways
open Polymorphic VIs
(VIs that include a drop-
down menu that allows
for changes to the VI
settings directly at the
VI).
As your experience with
programming increases
you will find which
process you prefer.
-
8/8/2019 LVEE Beginners User Guide
20/44
-
8/8/2019 LVEE Beginners User Guide
21/44
Nested Case Structures
Here are the paths of the Case Structures that are in thebackground of our example.
Note how the inner Case Structurenow shows the value as True andwhich motors are on/off havealternated.
* The outer Case Structure is still in the
True state. Otherwise the inner Case
Structure will not execute.
Note how the outer Case Structure
now shows the value as False andall motors are off.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 20
Programming Tip
Set the value of the Case
Structure (True/False)
by toggling the
value arrow.
The ? mark at the left
edge ofCase Structures
is the Case Selector.
The Case Structure is
wired to its trigger event
via the Case Selector.
Also note the Boolean
Value (Boolean simply
means there are two
choices) that routes to
the While Loop. We will
explain this further as we
go through writing the
program.
-
8/8/2019 LVEE Beginners User Guide
22/44
With all the parts of the program covered lets now walk through theprogramming process.
We will start with the Program Script.
The program instructs a LEGO NXT robot with differential drive (onemotor drives the left wheel, one motor drives the right wheel) tofollow a line and look for an end line on which to stop.
To follow the line the program references a light sensor (Port 3) setto respond to a light value of 45. If the value of the light sensor isTrue (45 or above meaning the light sensor sees white) the robotis instructed to turn left (left motor off/right motor on forward). If thevalue of the light sensor is False (below 45 meaning the lightsensor sees black) the robot is instructed to turn right (left motor onforward/right motor off).
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 21
Programming Tip
In this type of line
following routine it must
be determined which
side of the line the robot
will reside. In our
example the robot is on
the right side of the line
so the program must
instruct the robot to turn
right when it sees black
(away from the line) and
left when it sees white
(toward the line).
* The value the light
sensor looks for needs
to be determined at the
source (the actual
black line to be
followed).
-
8/8/2019 LVEE Beginners User Guide
23/44
The program also instructs the LEGO NXT robot to look for acrossing line by referencing a second light sensor (Port 2) also setto respond to a light value of 45. If the value of the light sensor isTrue (45 or above meaning the light sensor sees white) the robotis instructed to proceed with the inner Case Structure (i.e. moveforward following the line). If the value of the light sensor is False(below 45 meaning the light sensor sees black) the robot isinstructed to stop all motors and end the program.
So now lets dissect the program.
Loop Continuously
* The Boolean Value is set to be contrary to the Case Structure Value. This is
what always pushes the program to the subsequent fork of the Case
Structure and away from the End Loop Condition thus creating the
continuous loop .
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 22
Programming Tip
Programming
instructions are
hierarchical. As the
programmer you must
determine which events
control subsequent
events. Since we want
the robot to stop when it
sees a crossing line this
action ranks higher in
status than following the
line. Therefore, the stop
event is resident in theouter Case Structure and
the line following is
relegated to the inner
Case Structure.
Note how the program
loops back and checks
the status of the stop
event light sensor before
proceeding to the check
of the line following
sensor.
-
8/8/2019 LVEE Beginners User Guide
24/44
-
8/8/2019 LVEE Beginners User Guide
25/44
Check the Value of Light Sensor on Port 3
* The sensor on Port 3 is the trigger for the inner Case Structure.
* If the value of trigger is False the Case Structure instructions activate
(Read Sensor Port 3).
* If the value of the trigger is True the Switch Path of the Case Structure
activates and the program runs the other pathway of the Case Structure.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 24
Programming Tip
A False reading is in
alignment with the set
value of the inner Case
Structure so a False
reading on the sensor
will run the inner Case
Structure.
Note the alternate motor
settings to switch the
direction of the robot
left/right with the
transition between the
different paths of the
inner Case Structure.
-
8/8/2019 LVEE Beginners User Guide
26/44
So, let walk through the steps to write this program.
1) Open LVEE
2) Select Blank VI Targeted to NXT
3) Minimize the Front Panel or bring the Block Diagram to the front.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 25
Programming Tip
-
8/8/2019 LVEE Beginners User Guide
27/44
-
8/8/2019 LVEE Beginners User Guide
28/44
* A Note Regarding Tools (cont.)
However, there are those who prefer
to disengage the ATS and select tools
manually. To disengage the ATS
simply left-click on the ATS selection
button. You will know you are in
Manual Tool Selection (MTS) when
the cursor is a plus sign with no
degree sign present.
+
* For this tutorial we will make use
of the Tools Palette manually so
that you gain understanding of
the different tools on the Tools
Palette and how they are used.
Once complete, try the tutorialagain with the ATS engaged to
see how this functions.
5) Disengage Automatic Tool Selection.
* Note also how the ATS buttons
green light goes out when ATS is
turned off.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 27
Programming Tip
You can also bring up
the Functions Palette
by right-clicking on the
Block Diagram. This only
gives temporary access
to the Functions Palette
and it will move back to
the background after
your next access of the
Block Diagram.
You can lock the
Functions Palette to thedesktop through this
process if, once you
have displayed it, left-
clicking on the Push-Pin
(upper left corner of the
Functions Palette) to Pin
the Functions Palette to
the desktop.
-
8/8/2019 LVEE Beginners User Guide
29/44
-
8/8/2019 LVEE Beginners User Guide
30/44
-
8/8/2019 LVEE Beginners User Guide
31/44
12) Drag the Read Light (LED On)icon to the Block Diagram and
left-click to paste it in.
We now need to attach some Modifiers to the Read Light
(LED On) Function Block to set:
The light level to look for.
The way we want the program to manage the light
sensor data.
The Port where the sensor will be located.
13) While the Sensors menu is still
open, select and drag the Sensor
Port icon to the Block Diagram to
just above the Read Light sensor
icon.
14) Wire the Port Function Block tothe Read Light Function Block.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 30
Programming Tip
The auto-wiring feature
should wire the two icons
together.
* The wire should appear
as a pink line between
the two icons.
It should be noted that
auto-wiring places wires
at their appropriate
Terminals on the
Function Blocks
(icons). Each Function
Block has various
Terminals depending on
what Modifiers need to
be associated with the
Function Block in order
for it to operate as
intended. If you right-
click on a Function Block
and select
Visible Items/Terminals
you will see the Function
Block change from the
icon image to the
terminals image.
The Terminals are color
coded according to the
type of Modifier theyaccept.
* See how the wire
terminals are pink.
To activate the Wiring Tool go to the Tools Palette and
select the Wiring icon.
* Or hit the spacebar on your keyboard.
To Wire, left-click on the Wiring Terminal of the Port
Function Block and then on the Wiring Terminal of the
Read Light sensor Function Block.
* With the Wiring Tool activated the terminals will appear when
the Wiring Tool cursor image hovers over the Function
Blocks.
-
8/8/2019 LVEE Beginners User Guide
32/44
5) We will now set the port value by
selecting the arrow on the right of
the Port icon.
But before the arrow can be
selected the Selection Tool
(Pointing Finger) must be
activated, so go to the Tools
Palette select the Selection Tool.
Set the Read Light sensor toPort 2.
6) Double-click on the arrow next toNXT IO to minimize this menu.
Click on the arrow next to NXTProgramming to expand thismenu.
Select Comparison.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 31
Programming Tip
As you get familiar with
how the tools and
palettes work you will get
through these steps in
seconds.
What is now displayed in your Block Diagram should looksomething like this.
-
8/8/2019 LVEE Beginners User Guide
33/44
-
8/8/2019 LVEE Beginners User Guide
34/44
When Edit/Paste is selected a copy of the selected items appears in
the Block Diagram surrounded by a flashing line. While the line isflashing move the cursor within the flashing line boundary, press andhold down the left mouse button, and move the pasted items to thedesired location in the Block Diagram.
Left-click on an open area of the Block Diagram to set the pasteditems in place.
24) Change the port on the new Read Light sensor to Port 3.
25) Select the arrow next to NXTProgramming to minimize theNumeric menu.
Select Structures.
Select While Loop and drag it tothe Block Diagram.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 33
Programming Tip
We are using ports 3
and 2 for the Read Light
sensors as these are the
ports where the sensors
are plugged into our test
robot. If your robot has
the sensors plugged into
different inputs you will
need to adjust the port
numbers in the program
accordingly.
Likewise for the motor
ports. Our robot has the
motors plugged into the
B and C outputs with B to
the right motor and C to
the left motor.
Items can be placed in
the Block Diagram in any
order..
What is now displayed in your Block Diagram should looksomething like this.
Now lets add our first Structure.
The While Loop will surround all the programming
elements so click and hold down the left mouse buttonand stretch the While Loop across the Block Diagram sothat the elements we have created up to now are allwithin the While Loop.
-
8/8/2019 LVEE Beginners User Guide
35/44
26) The Structures menu is still openso select Case Structure anddrag it to the Block Diagram.
Stretch the Case Structure insidethe While Loop and around the
Read Light sensor on Port 3.
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 34
Programming Tip What is now displayed in your Block Diagram should look
something like this.
Now lets add a Case Structure.
-
8/8/2019 LVEE Beginners User Guide
36/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 35
Programming Tip
Note that when we add
a Case Structure it
originates in a True
state. Be sure you want
the visible items to
execute in the True
state or else they will
need to be changed.
27) Case Structures need a trigger event so wire the Greater ?
Comparison from the Read Light sensor on Port 2 (thesensor outside the Case Structure) to the Case SelectorTerminal on the Case Structure.
Also go ahead and wire the two Read Light sensorstogether.
As a Case Structure has both a True and False state we needto set the behaviors in the converse state.
28) Select the arrow in the State of the Case Structure and selectFalse from the menu that appears.
-
8/8/2019 LVEE Beginners User Guide
37/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 36
Programming Tip The False window of the Case Structure will now show.
29) Navigate through the Functions Palette toNXT IO/Complete/Motors/MotorBrake and drag the MotorBrake icon into the Case Structure. Pull it close to the wiringnode and it should auto-wire. If not, wire it manually.
30) Drag the Loop Condition icon up next to the lower rightcorner of the Case Structure.
At some point we need to set the Loop Condition for both theTrue and False Case Structure states so lets set the Falsestate Condition now.
31) Navigate through the Functions Palette to
NXT Programming/Boolean
Drag the True Constant icon inside the Case Structure(lower right corner) across from the Loop Condition.
Wire the True Constant and the Loop Condition together.
-
8/8/2019 LVEE Beginners User Guide
38/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 37
Programming Tip
The True and False
Constants can be
switched by simply left-
clicking on the Constant.32) Select the arrow in the State of the Case Structure and select
True from the menu that appears.
Now lets set the Boolean for the True state of the CaseStructure.
33) Navigate through the Functions Palette toNXT Programming/Boolean
Drag the False Constant icon inside the Case Structure(lower right corner) across from the Loop Condition.
Wire the False Constant and the Terminal Node that is onthe Case Structures edge together.
* The Terminal Node connects both states of the CaseStructure to the Loop Condition.
-
8/8/2019 LVEE Beginners User Guide
39/44
-
8/8/2019 LVEE Beginners User Guide
40/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 39
Programming Tip
There is a difference
between Motor Port and
Motor Ports so be sure to
grab the Motor Port here.
Now that we are using
the ATS, to wire
elements together you
simply place the cursor
over the terminal of the
element until the Wiring
Icon displays. Then
left-click to paste one
end of the wire, move the
cursor to the next
element to receive the
next end of the wire, then
left-click to paste the end
of the wire.
35) Navigate through the Functions Palette toNXT IO/Complete/Motors
Select/Add a Motor Break inside the new Case Structure.
Select/Add a Motor Port above the Motor Break.
Select/Add a Motor On inside the new Case Structure.
Select/Add a Motor Port above the Motor On.
36) Set the port locations for the left and right motors associatedwith the action they are to take.
* Remember, ports are relative to the robot built. Our test robothas the motors on ports B and C so these are the ones wemust choose from.
* Also remember that the action of the motor (On vs. Break) mustalign with the action needed at the robot. Our test robot isdesigned to follow the right edge of the line so when it sees theline we want it to turn away from the line (right) and when itdoes not see the line we want it to find the line (turn left). Ourrobot turns right by breaking the right motor while running the
left motor forward and vice versa for turning left. Thus, with theCase Structure in the True state (true meaning the value ofthe trigger is truein this case the Read Light sensor isGreater Than 45) then we know our robot is off the line and wewant it to turn left to find the line (left motor on Port C set toBreak, right motor on Port B set to On).
37) Wire the Motor Ports to the Motors On/Break
Wire the Motor On and Motor Break together
Wire the Read Light sensor on Port 3 to the first MotorOn/Break.
*Of course only if the auto-wire did not activate.
-
8/8/2019 LVEE Beginners User Guide
41/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 40
Programming Tip
When you copy/paste
you often disconnect
wires. You identify
broken wires by the
Broken Wire graphic.
If you develop a Broken
Wire you can:
Left-click on it and hit
delete.
Go to Edit on the
toolbar and select
Remove Broken Wires.
Or if it is a wire that
needs to be repaired
you can use the wiringtool and wire the
broken end to the
correct location.
38) Wire the Greater ? on the Read Light sensor on Port 3 to theCase Selectorof the new Case Structure.
Your program should now look something like this.
We are almost finished. All we have remaining is to build theactions for the False state of the inner Case Structure.
As the False state uses the identical elements as the Truestate (Motor On w/Port, Motor Break w/Port):
39) Copy the contents of the inner Case Structure.
40) Select the arrow in the State of the innerCase Structureand select False.
41) Paste the copied elements into the False state of theinner Case Structure.
42) Change the Motor Ports to reverse which motor is On and
which is set to Break from the settings in the True CaseStructure state.
43) Wire the pasted elements to the Read Light sensor thattriggers this inner Case Structure.
-
8/8/2019 LVEE Beginners User Guide
42/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 41
Programming Tip
Once you have students
writing programs it is
best to give them
independent folders to
store their programs so
that all the programs
dont get jumbled
together.
Your program will not run
if it has Code Errors.
*Code Errors deal with
errors in the software,
not with errors in theinstructions themselves.
If your robot drives in
reverse when you
wanted it to go forward
this is not considered a
Code error but a user
error.
You know if there are
Code Errors in your
program if the Run
button is a Broken Arrow.
Our program is now complete.
If you have not already done so along the way, lets save theprogram.
File/Save As
Name it what you like and select a location where you want tostore your programs
Select OK
Now we need to get our program to run on the robot.
To do this lets refer back to the Graphics Toolbar.
And specifically this section of the toolbar.
-
8/8/2019 LVEE Beginners User Guide
43/44
LVEE Beginner Programming Tutorial
Copyright 2009 Timothy E. Jump 42
Programming Tip
If you do end up with
Code Errors try using the
Debug Tool to help solve
the issue.
See your NXT user guide
for descriptions of all the
buttons and operating
instructions of the NXT.
This can also be
downloaded as a .pdf
and saved to your
computer from
http://cache.lego.com/do
wnloads/education/9797_LME_UserGuide_US_lo
w.pdf
If you want to run the program direct from the computerpress
And the robot will activate and follow the programinstructions.
* You must have the robot hooked to the computer via USB cableor wirelessly via the Bluetooth module if you want to runprograms direct from the computer.
If you want to download the program to the robot (to theNXT brick) press
The robot will not immediately start when a program isdownloaded to the NXT. The Run button on the NXT mustbe pressed to run programs resident on the NXT.
* You must also have the robot hooked to the computer viaUSB cable or wirelessly via the Bluetooth module todownload programs. But after the download is complete youcan disconnect from the computer as the NXT can now run
the program independent of the computer.
-
8/8/2019 LVEE Beginners User Guide
44/44
LVEE Beginner Programming Tutorial
Programming TipCongratulations! You have now finished this Introductionto programming with LVEE.
The more you practice the more you will develop personalpreferences on how you like to set and use the palettes, thetoolbars, and on how you like to construct your programs.Take the time to share with other programmers and connectwith LVEE and LEGO support organizations such as theCenter for Engineering Education and Outreach (CEEO) atTufts University.
http://www.ceeo.tufts.edu/
There is still much to learn about writing programs andprogramming philosophy.
Good Luck and Happy Programming!