The Controller as a User Interface
![VEXcode IQ project with 3 hat blocks. To the left attached to the When started block are first, blocks to set arm motor and claw motor stopping to hold, a set claw motor velocity to 60% and set arm motor velocity to 30%. Then a Forever loop contains an if then else block. The if block reads If Controller R Up pressed, then spin Claw motor close. The else branch contains an If then else block that reads If Controller R Down pressed then spin claw motor open, else stop clawmotor. To the right a When controller L Up pressed event block has a spin arm motor up, wait until not controller L up pressed, stop motor blocks attached. Beneath that a When Controller L Down button pressed event block has a Spin arm motor down, wait until not controller L Down pressed, stop arm motor attached.](/stemlabs/sites/default/files/inline-images/Controller%20Buttons.png)
Remotely Controlling the Robot
We most often use remote controls to interact with our televisions. We press buttons that make the television display a channel or information/access screen that we want. Technically, your television's remote control is a UI. However, it is a much less sophisticated UI than the one that your smartphone uses.
Programming your IQ Controller is much more sophisticated. During the Driver Controlled matches of a competition, you want your driver/team to have as many advantages as possible. You can program the buttons and joysticks to do more than one simple behavior, and you can program them to do complex behaviors when buttons/joysticks are used in combination - similar to how some gaming controllers work. As the programmer of your Controller, you consider which buttons to use in combination by figuring out how your fingers and hands would need to be placed in order to reach all of the buttons involved.
The image above shows the project from the Controller Buttons example project from VEXcode IQ. Do you see how the [Forever] loop has two [If then else] blocks nested inside of it? It makes the project check whether the R Up or R Down buttons are pressed, and the robot spins the Claw Motor closed or open based on one being pressed. That [Forever] loop is very important. It makes your IQ Controller check repeatedly on which button(s) is being pressed so that the robot performs the appropriate behavior(s).
Consider that you could put two <Controller Pressed> sensing blocks in an <and> operator block. That would have the project check if two buttons were being pressed. You could also put an <and> block inside of another <and> block and have three conditions being checked before a behavior is carried out. This would let you program sequences of behavior that can be started simply by pressing buttons on your controller.
Consider how many more combinations of conditionals you could create with all of the buttons and their combinations on the Controller. Of course, as you program more complex behaviors into the functioning of the Controller, the project gets closer to having the robot be autonomous. A competition team needs to figure out which are the best behaviors to program into their Controllers as complex sequences and which behaviors are best left decomposed into multiple parts so that the Controller lets the driver (user) have more control over the speed and accuracy of the behavior.