To program a device which can accelerate and decelerate.
ALL students will: Be able to create a program which can accelerate a motor.
MOST students will: Create a program which can accelerate a motor once a button is pressed.
SOME students may: Create a program which can accelerate and decelerate at the press of a button
Accelerate: To make something increase in speed
While Loop: We can execute a set of statements repeatedly as long as a condition is true.
Lets discuss this code!
Using the code above as a guide, create a program where the motor will accelerate to 20% power when a color sensor senses green.
Using the code above as a guide, add to your program so the motor will also decelerate the power when the color sensor senses red.
Take a screencast of your device working and explain what your program is doing.
Put this on your portfolio.
You may notice that you have to wait until the motor accelerates to 20%, before you can decelerate again to 0%.
Can you program the device so it doesn't have to wait?
Hint: Try using an IF function and a BREAK block.
As a reminder: Your code should now be task 1 and 2 combined. This goes on your portfolio.