Running your tabletop fan at different speeds
Now, let's code our tabletop fan motor (motor C) so that it moves this way at 70% speed for 10 seconds when the green flag is clicked.
Tip
Break down your problem statement into small problems before approaching it!
Let's break our problem statement into smaller steps:
- Step 1: Set the event to when the green flag is clicked.
- Step 2: Set motor C's speed to
70
percent. - Step 3: Set motor C's direction to this way.
- Step 4: Turn motor C on for
10
seconds. - Step 5: Turn motor C off.
If you break down your problem statement like this and write these step-by-step instructions each time, your coding job will be extremely easy and fun! Since this is your first time coding, please use the following sample code for this task:
Test it and see how much fun it is to use your fan to beat the summer blues!
Now, can you write some code that will move your tabletop fan motor C that way at 50
percent power for 10
seconds when the green flag is clicked?
Write down your problem steps here:
- Step 1: ____________________________________________________________
- Step 2: ____________________________________________________________
- Step 3: ____________________________________________________________
- Step 4: ____________________________________________________________
- Step 5: ____________________________________________________________
Now, write your code and see how it works! Identify any errors and rectify them. Make sure that your code works exactly the way we want it to work!
Now that you know how to run your tabletop fan, the next section will test your skills.