Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonPucheu committed Feb 11, 2024
1 parent 833fd00 commit b898a12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/Dozer/Dozer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include <Timino.h>
#include <StepperMotor.h>

#define MIN_SPEED 130
#define MIN_SPEED 90
#define DEFAULT_SPEED 180
#define MAX_SPEED 255

#define DIAGONAL_THRESHOLD 80
#define DIAGONAL_THRESHOLD 30

#define DEBUG false

Expand Down Expand Up @@ -86,7 +86,7 @@
// _________________________________________________ _________________________________________________ ___________________ //
// top bottom stby top bottom stby from to //
// _______________________ _______________________ _______ _______________________ _______________________ _______ _______ ________________ //
Mecanum mecanum(INA2_1, INA1_1, PWMA_1, INB1_1, INB2_1, PWMB_1, STBY_1, INA1_2, INA2_2, PWMA_2, INB2_2, INB1_2, PWMB_2, STBY_2, 0, 511, 0, DEFAULT_SPEED); //
Mecanum mecanum(INA2_1, INA1_1, PWMA_1, INB1_1, INB2_1, PWMB_1, STBY_1, INA1_2, INA2_2, PWMA_2, INB2_2, INB1_2, PWMB_2, STBY_2, 0, 255, 0, DEFAULT_SPEED); //

#include <Mecaside.h>
Mecaside left(Left, 255);
Expand All @@ -102,7 +102,7 @@ LedRGB bluetoothLed(RGBA_1, RGBB_1, RGBC_1, true);
LedRGB led2(RGBA_2, RGBB_2, RGBC_2, true);
Digit digit(DIGITB, DIGITA, 7);

SingleServo rackServo(SERVO_2, 130, 80);
SingleServo rackServo(SERVO_3, 100, 140);

StepperMotor rackStepper(STEP, DIR, LMTS_1, false, false, 3000, 2); /*, LMTS_2 */

Expand Down Expand Up @@ -237,34 +237,34 @@ void loop() {
const int joystickY = bluetooth.message.get(JOYSTICK_LEFT_Y);
if (joystickY > 255 && speedStatus != 1) {
#if DEBUG
Serial.println("boost");
#endif
Serial.println("boost");
mecanum.setMaxSpeed(MAX_SPEED);
speedStatus = 1;
} else if (joystickY == 255 && speedStatus != 0) {
#if DEBUG
Serial.println("default");
#endif
Serial.println("default");
mecanum.setMaxSpeed(DEFAULT_SPEED);
speedStatus = 0;
} else if (joystickY < 255 && speedStatus != 2) {
#if DEBUG
Serial.println("slow");
#endif
Serial.println("slow");
mecanum.setMaxSpeed(MIN_SPEED);
speedStatus = 2;
}
}
// Simple
{
left.move(constrain((-(bluetooth.message.get(JOYSTICK_RIGHT_X) - 255) + (bluetooth.message.get(JOYSTICK_LEFT_X) - 255)) + 255, 0, 512));
right.move(constrain((-(bluetooth.message.get(JOYSTICK_RIGHT_X) - 255) - (bluetooth.message.get(JOYSTICK_LEFT_X) - 255)) + 255, 0, 512));
left.move(constrain((-(bluetooth.message.get(JOYSTICK_RIGHT_X) - 255) + (bluetooth.message.get(JOYSTICK_LEFT_X) - 255)), -255, 255));
right.move(constrain((-(bluetooth.message.get(JOYSTICK_RIGHT_X) - 255) - (bluetooth.message.get(JOYSTICK_LEFT_X) - 255)), -255, 255));
}
// Others
{
mecanum.sideway(bluetooth.message.get(JOYSTICK_RIGHT_Y));
mecanum.sideway(bluetooth.message.get(JOYSTICK_RIGHT_Y) - 255);
if (abs(bluetooth.message.get(JOYSTICK_RIGHT_X) - 255) > DIAGONAL_THRESHOLD && abs(bluetooth.message.get(JOYSTICK_RIGHT_Y) - 255) > DIAGONAL_THRESHOLD) {
mecanum.diagonal(bluetooth.message.get(JOYSTICK_RIGHT_X), bluetooth.message.get(JOYSTICK_RIGHT_Y));
mecanum.diagonal(bluetooth.message.get(JOYSTICK_RIGHT_X) - 255, bluetooth.message.get(JOYSTICK_RIGHT_Y) - 255);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/BluetoothTest/BluetoothTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define NUM_VALUES 9

int sizes[NUM_VALUES] = { 1, 4, 8, 9, 9, 1, 9, 9, 1 };
Bluetooth bluetooth(&Serial1, sizes, NUM_VALUES);
Bluetooth bluetooth(&Serial1, sizes, NUM_VALUES, '.');

void setup() {
Serial1.begin(9600);
Expand Down

0 comments on commit b898a12

Please sign in to comment.