Question
3. Create the following code that uses the bumpers to open and close the claw. while True: while bumper a.pressing()=-True: motor 3.spin for (FORMARD, 90, DEGREES) while bumper h.pressing()=-True: motor 3.spin for(REVERSE , 90, DEGREES) What do you notice happens when you try to open and close the claw? What happens when the claw is completely open or closed?
Solution
4.2
(367 Votos)
Antoni
Elite · Tutor por 8 anos
Resposta
The program will keep running indefinitely, spinning the motor in the forward or reverse direction for 90 degrees depending on the state of the bumpers. The specific actions of the claw when it is completely open or closed would depend on the specific design of the claw and the bumpers.
Explicação
## Step 1The given code is a loop that runs indefinitely. This means that the program will keep running until it is stopped manually.## Step 2The first part of the code checks the state of the bumper. If the bumper is not being pressed, the program will spin the motor in the forward direction for 90 degrees.## Step 3The second part of the code checks the state of another bumper. If this bumper is not being pressed, the program will spin the motor in the reverse direction for 90 degrees.## Step 4The question asks what happens when the claw is completely open or closed. This would depend on the specific design of the claw and the bumpers. Generally, the claw would open or close based on the state of the bumpers. For example, if the claw is designed to open when the bumpers are not pressed, it would open when the program runs and the bumpers are not pressed.