T2W5: Programming VEX IQ Modules

Last week we introduced programming our Generation 1 VEX IQ kits.  For robots, the fun stuff is programming the motors and sensors to move the robot around and do behaviors.  To do this with VEXCode, we have to add the modules and do some configuration of them.  This will add code blocks for using the module to the list of blocks on the left of the screen, and allow us to use them in our programs.

Using your Lowell Chromebooks, visit https://codeiq.vex.com to load the programming environment.  Connect the VEX brain to your Chromebook with a USB A to USB Micro cable, select the "BRAIN" icon, click "Connect", and select the first serial device in the list to make the BRAIN icon turn green.  

To add support for the VEX modules you have connected when building the Autopilot robot, click on the icon that looks like a phone or network cable jack (circled in red below) and select "1st gen" for the IQ Robot Brain.  Then click "Add a device" and add each of the devices you plugged in to the brain, specifying the number of the port you connected them to.  If you followed the Autopilot robot instructions your list should look like this:

Once everything is set up, click on the device icon again to close the device setup window and give you more room for programming.

Programming the Modules

As each module is set up, the commands and functions associated with that module are added to the list of code blocks at the left.  Commands for the modules get their own  section named for the block, but other blocks get added to the "Events" or "Sensing" sections so you will have to scroll through the list to find them.  

To start, we can write a simple program to light up the TouchLED module and change its color when the switch is touched.  Here is a sample program, but feel free to add your own colors, sounds, or other functions like displaying text on the screen of the "brain" unit:

Note that the code blocks are color coded, so to find a block used in the program, click on the circle of the same color to scroll down to that section.

Robot of the Week

Each week I will find a quick video of a different robot companions, to help inspire your own creations.  This week's robot is Nybble from Petoi Robotics:


Nybble looks very cute but I'm not sure how practical it would be for a beginner - programming a quadruped robot is difficult and there aren't a lot of sensors for interaction.