Skip to main content

Tips for Coding Moby

There are many other ways to code Moby using VEXcode V5 features or other elements of the robot. This is not an exhaustive list, but a great place to get started as you continue to code Moby.

Printing to the Console

You can print text or values to the console to monitor values while a project is being executed.

When the project is started in this example, Moby will print the GPS's current x position, before driving until the GPS's x position is less than 0mm. The values will be printed on the console and then Moby will turn right to face a Mobile Goal.

Printing to the console example

"And don't wait" Modifier

It is possible to change some blocks from waiting to non-waiting by selecting the white arrow on the side of the block.

In this example, when the project is started Moby will begin lowering the Forks and driving towards the Neutral Mobile Goal simultaneously because the [Spin for] block has the "and don't wait" modifier selected.

For more information about the difference between waiting and non-waiting blocks in VEXcode V5, see this Knowledge Base article.

And dont wait modifier

Optical Sensor

Moby is equipped with an Optical Sensor between the Forks. This can be used to detect if a Mobile Goal is near the sensor, and if so, what color it is.

In this example, Moby will drive toward the red Mobile Goal that is detected as an object by the Optical Sensor. Since the Mobile Goal is red and not yellow, Moby will drive in reverse and turn toward the next closest Mobile Goal, which is the Neutral Mobile Goal. Since the Neutral Mobile Goal is yellow, Moby will pick it up.

For more information about the V5 Optical Sensor, see this Knowledge Base article.

optical sensor blocks

My Blocks

My Blocks are helpful when using the same stack of blocks multiple times throughout a project. 

In this example, the same stack of blocks used to score Rings into Mobile Goals was used with a My Block. This allows the behaviors for scoring Rings to be used multiple times in the project without having to duplicate the stack of blocks each time.

For more information about using My Blocks in your project, see this Knowledge Base article.


My Blocks

Multiple {When Started} Blocks

By using multiple {When started} blocks, you can start two or more stacks of code at the same time.

When the project is started in this example, Moby will begin executing the Lesson 6 project, and will simultaneously print the x and y location of the center of rotation to the console every 0.25 seconds.

multiple when started blocks