In this lesson, we will introduce how to use a rotary encoder to control a robotic arm.
26.1 About the rotary encoder
Rotary encoder is a device used to measure the speed and cooperate with PWM technology to achieve rapid speed adjustment. By photoelectric conversion, the photoelectric rotary encoder can convert the angular displacement and angular velocity of the output shaft into corresponding electrical pulses for digital output (REP). In this lesson, the rotary encoder we use mainly acts as a switch button. With this feature of the rotary encoder, you can use it to control the robotic arm.
26.2 How to use a rotary encoder to control a robotic arm
1. First, you need to supply power to the robotic arm, and the OLED screen is lit (if the screen is not lit, then you need to ensure that you have successfully installed the dependent libraries according to the content of 2.2), you will see the first level directory:
2. In the first-level directory, you will see three options. When you want to enter the first option, you can rotate it by operating the rotary encoder.
3. How to enter "XYZ CTRL", when "<<<" is marked in the first option, you can press the rotary encoder to enter the first option, as shown below:
When "<<<" is marked in the first item: X-ALLXS, press the rotary encoder at this time to turn on the mode of controlling the end point of the robotic arm to move in the X-axis direction. Then you can control the robotic arm by the rotary encoder.
4. How to return to the previous or first level main catalog, you can return to the previous or first main catalog by long pressing the rotary encoder.
5. After returning to the main menu, you can use the rotary encoder. When "<<<" is marked in the second option, you can press the rotary encoder to enter the second option: SERVO CTRL, this mode controls the A, B, C, D servos on the robotic arm structure respectively. You can select A-SERVO by pressing, and the rotary encoder controls the movement of the A servo, as shown in the following figure: