Step Forward or Step Back?

Shift Registers

Shift Registers

So far, we have created code that allows us to move the robot in one direction. In this section we will learn how to make the robot move in the opposite direction of its last movement. In order to do this we will need to learn how to utilize loop memory.

Select

Select

If we want the robot to move in the opposite direction, the program needs to remember which direction it went in last. To remember information from loop to loop, we will use  Shift Registers. A shift register takes information that is inputted into the right terminal and makes it accessible from the left terminal in the next loop.

Not

Not

To make our robot move in the opposite direction we will use two functions. The first is the “Select” function, which outputs data based on whether it receives and input of TRUE or FALSE. The second is the “Not” function, which flips Boolean constant (True->False, False->True)

Left Arrow Right Arrow