This block can be found under the Robots palette in the extension evive Tinkering. This takes the motor port, direction of rotation and speed of rotation as input from the user and moves the motor accordingly. There are two motor ports M1 and M2, you can choose either depending on which port you’ve connected the motor. If you choose direction 1 then pin 1 of the motor becomes high while pin 2 becomes low hence the rotation occurs in direction 1. The speed of the motor is expressed in the form of PWM ranging from 0 to 255 (8 bits).
- This script checks (through the button pressed at pin () block) if the switch connected to digital pin 2 is pressed. If it is pressed it rotates the motor else the motor remains stationary.
- In this example, motor will run in full speed in direction 1 for 1 second, then it will lock for 1 second, then run in direction 2 for 1 second, then it will be free for 1 second, and repeat the process again.