TETRIX® Add-On Extensions Conveyor Belt Conveyor Belt Programming Guide (LabVIEW™ for LEGO® MINDSTORMS®) Introduction: In this guide, the Ranger Bot with Conveyor Belt will be programmed to move forward until it detects an object and will then dispense a ball into the detected object. After dispensing the ball, the robot will back up, turn 90°, and then repeat the whole procedure three more times. In total, the program will detect four objects and dispense four balls. This guide is for use with the LabVIEW™ for LEGO® MINDSTORMS® programming language. Review: •To review the basic principles of connecting to the NXT Brick and configuring LabVIEW for LEGO MINDSTORMS for use with various sensors and motors, go over the programming guides and tutorial videos from Lessons 2 and 3 in the TETRIX® Getting Started Guide. •To review the basic principles of programming in LabVIEW for LEGO MINDSTORMS, go over the programming guides and tutorial videos from the Line Follower Programming Extension in the TETRIX Getting Started Guide. •These materials contain detailed information about how to use the Schematic Editor and how to create the structures, functions, constants, and wires that are presented in this guide. •This program makes use of the Screen Update SubVI provided on the TETRIX Getting Started Guide Resources page. This function uses the NXT to display custom text as well as light and Ultrasonic Sensor readings. •Use these steps to add the function to the program: a. Within the block diagram, right-click to bring up the Functions palette and choose Select a VI. b. Then navigate to where the Screen Update SubVI is saved. Note:If the Screen Update SubVI has not been saved on the computer in a specific location already, download it from the TETRIX Getting Started Guide by navigating to the Resources tab and selecting the Screen Update SubVI Program (LabVIEW for LEGO MINDSTORMS) button. c. Once the Screen Update SubVI has been located, open it and place it on the block diagram. Getting Started: 1. Create a new Ranger robot project and name it Conveyor Bot. 2. Check the Schematic Editor to make sure all the motors and sensors match your robot’s hardware setup. An NXT motor will need to be added. Also, make sure proper options are checked on the motors. 74 Conveyor Belt TETRIX® Add-On Extensions Conveyor Belt Programming Guide (LabVIEW™ for LEGO® MINDSTORMS®) 3. Create a new VI. 4. Create a For Loop that will encase the code. a. Wire a constant of 4 into the Loop Count terminal. 5. Create a small While Loop inside the For Loop that drives forward until an object is detected. a. Place a Move Motors function in the While Loop. b. Create a motors constant, drag it outside both the loops, and rewire it to the Move Motors function. c. Expand the constant and select Left Wheel and Right Wheel, respectively. d. Create a constant of 15 and wire it into both power terminals. e. Drag a Screen Update SubVI into the While Loop. f. Use a Less? function to compare the Sonar Distance with a constant of 16. g. Wire the output of the Less? function into the While Loop’s condition terminal. h. Wire the NXT terminals. 6. After detecting an object, stop the motors and use the conveyor belt to drop a ball. a. Place a Stop Motors function outside of the While Loop, but inside the For Loop, and wire it up to the already existent motors constant. b. Use a Drive Distance NXT motor function to move the conveyor belt motor. c. Create a port constant and select Port A. d. Create a constant of 40 and wire it into the Power terminal, and create a constant of 28 and wire it into the Angle of Rotation terminal. e. Place a Wait for Time (msec) function with a constant of 1500. f. Place a Motor Brake NXT Motor function to ensure the conveyor belt is stopped properly. g. Wire the NXT terminals. 75 TETRIX® Add-On Extensions Conveyor Belt Conveyor Belt Programming Guide (LabVIEW™ for LEGO® MINDSTORMS®) 7. Back up the robot and turn approximately 90 degrees to the right. a.Use a Move Motors function and wire it to the motor constant. b.Create a constant of -30 and wire it into both power terminals. c.Add a Wait for Time (msec) function and add a constant of 800. d.Use another Move Motors function and wire it to the motor constant. e.Wire a constant of 30 into the power terminal for the left wheel, and wire a constant of -30 into the power terminal for the right wheel. f. Add a Wait for Time (msec) function and add a constant of 700 (this turn duration might vary for each robot). g.Wire the NXT terminals. 8. Finally, after the robot has gone through four iterations, the robot should stop. a.Outside of the For Loop, add a Stop Motors function. b.Wire both the motors constant and NXT wires through the For Loop. c.To fix the broken wires, you must right-click each tunnel and select Disable Indexing. 76
© Copyright 2026 Paperzz