Hi Ruldi, thanks for this nice video 8)
Is it possible to use the bt comander buttons to adjust the speed?
This is Andro_four_PWM_D.ino (rev D)
- Button management implemented
- High/Low speed using Button #1
- default mode is Low speed
Make sure to connect Arduino D1 to RX BT module,
DEBUG should now be set to 'false' at all time
Button #1 management code:
void getButtonState(int bStatus) {
switch (bStatus) {
// ----------------- BUTTON #1 -----------------------
case 'A':
buttonStatus |= B000001; // ON
fullSpeed = true;
displayStatus = "Turbo";
break;
case 'B':
buttonStatus &= B111110; // OFF
fullSpeed = false;
displayStatus = "Low speed";
break;
Within setMotorSpeed() function:
if(fullSpeed == true) {
pwm_1_a = map(joyX, 100, 200, 255, 0); //mapeamento para 0-100 pino A - 100-200 pino B
pwm_1_b = map(joyX, 200, 300, 0, 255);
pwm_2_a = map(joyY, 100, 200, 255, 0); //mapeamento da ponte 2
pwm_2_b = map(joyY, 200, 300, 0, 255);
}
else {
pwm_1_a = map(joyX, 100, 200, 127, 0); // Low speed
pwm_1_b = map(joyX, 200, 300, 0, 127);
pwm_2_a = map(joyY, 100, 200, 127, 0); // Low speed
pwm_2_b = map(joyY, 200, 300, 0, 127);
}
I suggest you access the App config menu and
- display two buttons only
- rename Button #1 to "Turbo"
Happy driving