Lab 3 Tuesday, September 7, 2021
Topic: Selection
Description: This lab session will deal with having the vehicle/block identify which input is specified and displaying the appropriate message on the screen.
Components:
- Go to Units and select Robot Trainer. Build the Cuboid in the Objects and Obstacles tutorial (do not complete the rest of this tutorial at this time).
- Connect a touch sensor, light sensor, and ultrasonic sensor to your vehicle. The vehicle will not be moving for this lab, so you dont need to attach the sensors with anything more than just the wires.
- Using only one column of instructions, program your vehicle to respond to a button clicked and held on the block (tip: you might want to give yourself some time between starting the program and when it queries the buttons). When the appropriate button is clicked, the program should wait 2 seconds and then read the associated sensor. At the end, the program should display what sensor was read and the value that was read (where appropriate). It should do this only once per program execution.
- Test your code using all three types of sensors in any order. Use the cuboid to get different color and distance readings from the appropriate sensors.
- Create your own custom block that contains the embedded IF structure. Replace the appropriate components with your new block in the main stack.