1. Move¶
Before we start programming, let’s review the working principle of L9110 module.
Here is the truth table of Motor B:
B-1A |
B-1B(B-2A) |
The state of Motor B |
---|---|---|
1 |
0 |
Rotate clockwise |
0 |
1 |
Rotate counterclockwise |
0 |
0 |
Brake |
1 |
1 |
Stop |
Here is the truth table of Motor A:
A-1A |
A-1B |
The state of Motor B |
---|---|---|
1 |
0 |
Rotate clockwise |
0 |
1 |
Rotate counterclockwise |
0 |
0 |
Brake |
1 |
1 |
Stop |
Forward
Now let’s connect the input of L9110 module directly to 12V and GND respectively to make the car move.
Connect R4 board, L9110 module and 2 motors.
Connect B-1B(B-2A) and A-1A to VCC, and B-1A and A-1B to GND, then you will be able to see the car moving forward.
If not both turn forward, but the following situations occur, you need to readjust the wiring of the two motors.
If both motors turn backward at the same time (left motor turns clockwise, right motor turns counterclockwise), swap the wiring of the left and right motors at the same time, OA(A) and OB(A) swap, OA(B) and OB(B) swap.
If the left motor turns backward (clockwise rotation), exchange the wiring of OA(B) and OB(B) of the left motor.
If the right motor turns backward (counterclockwise rotation), swap the wiring of OA(A) and OB(A) of the right motor.
Backward
Connect B-1B(B-2A) and A-1A to GND, and B-1A and A-1B to VCC, then you will be able to see the car moving backward.
Turn Left
If you want to make the car turn left, that is, make both motors turn clockwise. You need to connect B-1A and A-1A to GND, and B-1B(B-2A) and A-1B to VCC.
Turn Right
Conversely, if you want to turn the car to the right, that is, make both motors turn counterclockwise. You need to connect B-1A and A-1A to VCC and B-1B(B-2A) and A-1B to GND.
Stop
To stop the motor, connect the inputs on the same side to 12V or GND at the same time, e.g. connect B-1A and B-1B(B-2A) to 12V or 5V at the same time, and the same for A-1A and A-1B.
This is of course theoretical and needed later on when controlling with code. Here remove the power supply to the car can stop it.