In this lesson we are going to move robot in different directions such as Forward, Reverse Left, Right along with stop condition. Before starting actual program lets learn about basics of Robot Movement. Humans are having legs which are for walking purpose. Like humans robots are having wheels to make a move from one place to another. Not only wheels are sufficient but to move those wheels motors are important. Motor is a device which accepts electricity or power and converts it into mechanical action. We can easily find motors in household such as for drawing waters from tanks. Those are AC motors. Generally this uses AC electricity. Motor converts one form of energy into another. Mechanical action is nothing but movement of motor shaft.
- There are many types of motors. We are using DC motors. The motor which we are using for our Playme Robot is BO motor. It has pink color shaft and yellow color cover.
- This motor has two wires. It does not have polarity. Means we can connect wire 1 to positive or negative. Same is applicable to wire 2. But if 1 wire is connected to positive or + then second wire should be connected to negative or – sign.
- DC motor for playme can be controlled by brain of the system called as Arduino. It helps to move motor in forward and reverse direction.
- But Arduino cannot do it alone, Because motors required more current that Arduinos capacity. For example if we are trying to lift some weight which is beyond our capacity… Then what will happen???? In this we may hurt ourselves.
- Same is in case of motors and Arduino. Motors are heavy weights and Arduino like us. So what we should do now?? Answer is we have to get something which will boost current or which will accept signals from arduino and it will amplify it to certain level which is suitable for motors.
- We can called such Driver circuit. In this we are using L293D which used for DC motors. It can run two motors simultaneously.
- Go to mblock software and open it. Go to edit menu and select Arduino mode.
- mblock Arduino mode selection
- Single Motor Programming
- Playme Motor Program is a Header file for Robot programming. It makes programming simple.
- By using this we can access all blocks easily and smoothly.
- If we are not using this then it may give us errors in program.
- So put this at start of program.
- Here we are using loop. Loop is area which will be repeated for certain times depending upon its type.
- If we write anything inside loop then it will be repeated along with loop.
- Forever loop means program will run continuously.
- For example if we write a program to run motor in forward direction with forever loop then it will run until we remove power applied to it.
- In this we are going to move single motor i.e. Left Motor. For that we are using Playme left motor 0,HIGH block. Here 0 indicates lowest speed of motor and 255 is highest speed motor.
- Speed of motor is nothing but how many circular rotation it is going to complete in one minute. It is measured in Rotation Per Minute(RPM). HIGH or LOW decides direction of motor either forward or reverse.
- While performing this task you have to check direction of motor by changing HIGH ,LOW in block. Some people may get forward direction after HIGH or some may get forward after putting LOW inside block.
- Now in this we are using two motors left as well as Right. Using this we can move both motors Simultaneously.
- Here we are taking both motor at 255 i.e maximum speed with LOW and HIGH.
- LOW means one direction and HIGH means other direction of motor
- For my robot forward direction is when left motor is LOW and right motor is HIGH, You may get different one.
with Below program, the robot will generate some movement, either forward, reverse, left or right, depending upon your robot, and then move for 1 second and then stop
Similarly, you can trial with your robot to generate LEFT, RIGHT, FORWARD and REVERSE Direction Control
To make the Movement control simpler, we’ve also given direct robot movement control blocks
These 4 Blocks are provided for 4 different motions of the Robot and they’ll control the Robot movement exactly with the given PERCENTAGE of speed
Try below program and see if the robot follows your command properly