20constexpr uint32_t kPPR = 12;
21constexpr uint32_t kReductionRation = 90;
23#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
125 Serial.begin(115200);
126 printf(
"setting up\n");
128 g_encoder_motor_0.Init();
129 g_encoder_motor_1.Init();
130 g_encoder_motor_2.Init();
131 g_encoder_motor_3.Init();
132 printf(
"setup completed\n");
136 const int16_t speed_rpm = 100;
138 g_encoder_motor_0.RunSpeed(speed_rpm);
139 g_encoder_motor_1.RunSpeed(speed_rpm);
140 g_encoder_motor_2.RunSpeed(speed_rpm);
141 g_encoder_motor_3.RunSpeed(speed_rpm);
143 printf(
"target speed rpm: %" PRIi16
", current speed rpm: [%4" PRId32
", %4" PRId32
", %4" PRId32
", %4" PRId32
144 "], pwm duties: [%5 " PRIi16
", %5" PRIi16
", %5" PRIi16
", %5" PRIi16
"], pulse counts: [%" PRId64
", %" PRId64
145 ", %" PRId64
", %" PRId64
"]\n",
147 g_encoder_motor_0.SpeedRpm(),
148 g_encoder_motor_1.SpeedRpm(),
149 g_encoder_motor_2.SpeedRpm(),
150 g_encoder_motor_3.SpeedRpm(),
151 g_encoder_motor_0.PwmDuty(),
152 g_encoder_motor_1.PwmDuty(),
153 g_encoder_motor_2.PwmDuty(),
154 g_encoder_motor_3.PwmDuty(),
155 g_encoder_motor_0.EncoderPulseCount(),
156 g_encoder_motor_1.EncoderPulseCount(),
157 g_encoder_motor_2.EncoderPulseCount(),
158 g_encoder_motor_3.EncoderPulseCount());
@ kAPhaseLeads
Represents the situation where phase A leads phase B when the motor is rotating forward.
String Version()
Get the version number string.