Skip to main content
Teacher Portal

Teacher Toolbox icon Teacher Toolbox - Facilitating the Boolean Variables page

What the Teacher Will Do:

  • Instruct students that they will be working together in their groups to follow the steps on this page.
  • Circle the classroom as students work through these steps and answer any questions that arise.
  • As groups check in, ensure they have built their project correctly and can accept the first green disk before moving on. Guidance for this check in is provided in a Teacher Toolbox at the bottom of this page.

Now that you have successfully accepted the first green disk, you will now code any additional green disks to be rejected. To do this, a tracking system needs to be established to track if the first green disk has already been accepted. 

A variable will be used to establish this tracking system. Variables were introduced in Lab 5 and are used to store values in a project. A Boolean variable is a special type of variable that stores one of two values - either true or false.

In this project, you will create a Boolean variable to store true and false values to track when the first green disk has been accepted.

This allows any other green disks introduced via the Disk Feeder to be rejected and diverted off of the exit conveyor.

Boolean

You will now create the greenAccepted Boolean variable that you will use in your 'Lab 11- Disk Feeder' project. 

In VEXcode V5, follow the steps in this video to create the greenAccepted Boolean variable. 

Because the project will start by accepting the first green disk, the Boolean variable is set to ‘true.’

Follow the steps in this video to set the greenAccepted Boolean variable to 'true' at the beginning of the project.

For Your Information

The [If then else] block runs the blocks inside the first or second branch based on the Boolean value reported.

If the Boolean condition is reported as true, the blocks inside of if section will be run.

If the Boolean condition is false, the blocks inside of else section will be run.

If then else

To be able to distinguish if the green disk that is dispensed should be accepted or rejected, an [If then else] block will be needed. 

The if branch of the [If then else] block will run when the greenAccepted Boolean variable is 'true.' 

Follow the steps in this video to add the [If then else] block. 

The branch of the [If then else] block runs depending on the true or false value of the Boolean condition. 

Follow the steps in this video to set the greenAccepted Boolean variable as the condition of the [If then else] block. 

After the first green disk is accepted, the greenAccepted variable must be set to 'false' to indicate that no additional green disks will be accepted. 

Follow the steps in this video to set the condition of the [If then else] block and to set the greenAccepted Boolean variable to 'false.' 

Load three green disks into the Disk Feeder and download and run the project.

The first green disk will be accepted and then the greenAccepted Boolean variable will be set to 'false.'

Once the green disk has stopped in front of the pickup sensor, stop the project and check in with your teacher. 

If the green disk did not follow the path shown, notify your teacher during the check in.

Green path

Teacher Toolbox icon Teacher Toolbox - Troubleshooting

If groups are finding issues with accepting the first green disk using the greenAccepted Boolean variable, try the following troubleshooting techniques.

  1. Check the VEXcode V5 project.
    1. Review the project with the group ensure the order of the blocks match. Make sure students are re-downloading their project each time they make a change and before they run the project.
      Boolean
    2. Ensure the greenAccepted Boolean variable is set to 'true' at the beginning of the project. This is important to ensure that the condition [If then else] block is starting with the variable being set to 'true.'
      True
    3. After the first green disk has been accepted, ensure that the greenAccepted Boolean variable is set to 'false.' Setting the variable to 'false' ensures that no other green disks will be accepted.
      False
  2. Check the build. 
    1. There may be a mechanical issue with your Workcell. Instruct students to look at the Lab 11 build instructions first and verify that they attached the Disk Feeder correctly to their Workcell.

Teacher Toolbox icon Teacher Toolbox - Check in

Review the following with the group during their check in:

  • Check that all groups have successfully gone through all the steps on the page. Ask them to run their project for you, so you can see the first green disk being accepted now using the greenAccepted Boolean variable. If the project does not run as expected, see the Troubleshooting Teacher Toolbox above.
  • Ask students the following questions as students are presenting their projects.
    • Did your project run the first time you tested it? If not, what did you change?
    • How was this project different than the one on the previous page now that you've added a Boolean variable?
    • What blocks do you think you will need to reject any additional disks?
      • Where do you think these blocks will go in your project, and why?
    • Because you have the greenAccepted Boolean variable in your project, are you limited to just sorting three green disks?
      • Could your project support accepting or rejecting more green disks if you wanted it to?