Linkbot and myRIO/LED Example

From LinkbotLabs
Jump to: navigation, search

Introduction

This brief project demonstration will introduce you to the basics of the myRIO Linkbot Toolkit. You should already be familiar with basic Labview programming concepts, such as how to wire VIs together and how loop structures work. Once you have completed this project, you should have a basic understanding for how to use the Linkbot Toolkit VIs.

Project Details

Connect a Linkbot to the myRio

First, connect a Linkbot to the myRIO using a micro-USB cable. Power the Linkbot on by holding down the power button until the Linkbot flashes a red LED several times, indicating that it is in the process of booting up.

Create a New myRIO Project

From the Labview Intro screen, click on "Create Project -> (Templates -> myRIO) -> myRIO Project" . Name your project something meaningful. After you have completed the dialogs, you should see the project structure shown here:

Initial Project Structure

Open "Main.vi" by double clicking on it, and look at the block-diagram of the template VI. It should appear similar to the image below.

Initial Block Diagram

Add Linkbot Toolkit VIs

We will use the existing template and add a color chooser box that sets the color of the Linkbot's LED. To begin, Add "New", "LED", and "Close" sub-VI blocks from the Linkbot toolkit so that your VI looks like the image below. You can find the VIs by right-clicking on the background of the block diagram and navigating to the "Linkbot Toolkit" subsection in the context menu.

Add "New", "LED", and "Close" VIs

The "New" subVI takes a "serial ID" as an argument. The serial ID of a Linkbot is the four digit alphanumeric string printed above the "A" and "B" buttons. Right-click on the "serialID" terminal of the "New" subVI and click on "Create -> Constant". This will create a blank text string. Fill the text string with the serial ID of the robot that is connected to your myRIO.

Next, wire the Linkbot output terminal on the top right of the "New" VI to the top left of the LED VI, and from the top right of the LED vi to the top left of the "Close" VI. Do the same for the error terminals. When you are done, your block diagram should look similar to the following:

Block diagram wired up

Add a control to adjust the LED color

Now we'll need to create a control to modify the LED color on the Linkbot. Right-click on the "Color Box" terminal of the "LED" VI and select "Create -> Control". This will create a Color Box on the front panel. Move the color box somewhere appropriate so that your front panel looks like the following image:

Front Panel with Color Box


You may now run your project. While your project is running, try clicking on the color box on the front panel and changing the color. The Linkbot should immediately modify its LED color to match the color you have chosen.