pleasedontcode

# Bluetooth Controller rev_01

Mar 12th, 2026
35
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 12.31 KB | None | 0 0
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: # Bluetooth Controller
  13.     - Version: 001
  14.     - Source Code NOT compiled for: Arduino Uno
  15.     - Source Code created on: 2026-03-12 12:50:57
  16.  
  17. ********* Pleasedontcode.com **********/
  18.  
  19. /****** SYSTEM REQUIREMENTS *****/
  20. /****** SYSTEM REQUIREMENT 1 *****/
  21.     /* Receive movement commands via HC-05 Bluetooth */
  22.     /* module (Forward, Backward, Left, Right, Stop) */
  23. /****** SYSTEM REQUIREMENT 2 *****/
  24.     /* Control 4 DC motors (Motor1, Motor2, Motor3, */
  25.     /* Motor4) via motor driver based on Bluetooth */
  26.     /* commands */
  27. /****** SYSTEM REQUIREMENT 3 *****/
  28.     /* Forward movement: all 4 motors rotate in same */
  29.     /* direction at full speed */
  30. /****** SYSTEM REQUIREMENT 4 *****/
  31.     /* Backward movement: all 4 motors rotate in opposite */
  32.     /* direction at full speed */
  33. /****** SYSTEM REQUIREMENT 5 *****/
  34.     /* Left movement: left-side motors reverse, right- */
  35.     /* side motors forward for strafing motion */
  36. /****** SYSTEM REQUIREMENT 6 *****/
  37.     /* Right movement: right-side motors reverse, left- */
  38.     /* side motors forward for strafing motion */
  39. /****** SYSTEM REQUIREMENT 7 *****/
  40.     /* Stop command: halt all motors immediately */
  41. /****** SYSTEM REQUIREMENT 8 *****/
  42.     /* Variable speed control: adjust motor speed based */
  43.     /* on Bluetooth data (0-255 PWM) */
  44. /****** END SYSTEM REQUIREMENTS *****/
  45.  
  46.  
  47. /****** DEFINITION OF LIBRARIES *****/
  48. #include <EasyButton.h>  // https://github.com/evert-arias/EasyButton
  49. #include <SoftwareSerial.h>  // For HC-05 Bluetooth communication
  50.  
  51. /****** FUNCTION PROTOTYPES *****/
  52. void setup(void);
  53. void loop(void);
  54. void initializeMotorPins(void);
  55. void initializeBluetooth(void);
  56. void processBluetooth(void);
  57. void moveForward(uint8_t speed);
  58. void moveBackward(uint8_t speed);
  59. void moveLeft(uint8_t speed);
  60. void moveRight(uint8_t speed);
  61. void stopAllMotors(void);
  62. void setMotorSpeed(uint8_t motor, uint8_t direction, uint8_t speed);
  63.  
  64. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  65. const uint8_t Motor1_PushButton_PIN_A0 = A0;
  66.  
  67. /***** DEFINITION OF ANALOG INPUT PINS *****/
  68. const uint8_t Motor4_Potentiometer_Vout_PIN_A5 = A5;
  69.  
  70. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  71. const uint8_t Motor2_LED_PIN_A1 = A1;
  72. const uint8_t Motor3_LEDRGB_Red_PIN_A2 = A2;
  73. const uint8_t Motor3_LEDRGB_Green_PIN_A3 = A3;
  74. const uint8_t Motor3_LEDRGB_Blue_PIN_A4 = A4;
  75.  
  76. /****** MOTOR DRIVER PIN DEFINITIONS FOR ARDUINO UNO *****/
  77. // Motor 1 (Left-Front): Pins 2 (Direction) and 3 (PWM Speed)
  78. const uint8_t MOTOR1_DIR_PIN = 2;
  79. const uint8_t MOTOR1_PWM_PIN = 3;
  80.  
  81. // Motor 2 (Right-Front): Pins 4 (Direction) and 5 (PWM Speed)
  82. const uint8_t MOTOR2_DIR_PIN = 4;
  83. const uint8_t MOTOR2_PWM_PIN = 5;
  84.  
  85. // Motor 3 (Left-Rear): Pins 6 (Direction) and 9 (PWM Speed)
  86. const uint8_t MOTOR3_DIR_PIN = 6;
  87. const uint8_t MOTOR3_PWM_PIN = 9;
  88.  
  89. // Motor 4 (Right-Rear): Pins 7 (Direction) and 10 (PWM Speed)
  90. const uint8_t MOTOR4_DIR_PIN = 7;
  91. const uint8_t MOTOR4_PWM_PIN = 10;
  92.  
  93. /****** HC-05 BLUETOOTH MODULE PIN DEFINITIONS *****/
  94. // RX pin on Arduino (connects to TX on HC-05)
  95. const uint8_t HC05_RX_PIN = 8;
  96. // TX pin on Arduino (connects to RX on HC-05)
  97. const uint8_t HC05_TX_PIN = 11;
  98.  
  99. /****** MOTOR DIRECTION CONSTANTS *****/
  100. const uint8_t MOTOR_FORWARD = HIGH;
  101. const uint8_t MOTOR_BACKWARD = LOW;
  102.  
  103. /****** BLUETOOTH COMMAND CONSTANTS *****/
  104. const char CMD_FORWARD = 'F';
  105. const char CMD_BACKWARD = 'B';
  106. const char CMD_LEFT = 'L';
  107. const char CMD_RIGHT = 'R';
  108. const char CMD_STOP = 'S';
  109. const char CMD_SPEED_SEPARATOR = ':';
  110.  
  111. /****** DEFINITION OF LIBRARIES CLASS INSTANCES *****/
  112. // SoftwareSerial for HC-05 Bluetooth module (RX, TX)
  113. SoftwareSerial bluetoothSerial(HC05_RX_PIN, HC05_TX_PIN);
  114.  
  115. /****** GLOBAL VARIABLES *****/
  116. uint8_t currentSpeed = 255;  // Default speed is maximum (255)
  117. char lastCommand = 'S';      // Last received command (default: Stop)
  118.  
  119. void setup(void)
  120. {
  121.   // Initialize serial communication for debugging
  122.   Serial.begin(9600);
  123.  
  124.   // Initialize motor control pins
  125.   initializeMotorPins();
  126.  
  127.   // Initialize Bluetooth communication
  128.   initializeBluetooth();
  129.  
  130.   // Initialize pushbutton pin
  131.   pinMode(Motor1_PushButton_PIN_A0, INPUT_PULLUP);
  132.  
  133.   // Initialize potentiometer pin
  134.   pinMode(Motor4_Potentiometer_Vout_PIN_A5, INPUT);
  135.  
  136.   // Initialize LED pins
  137.   pinMode(Motor2_LED_PIN_A1, OUTPUT);
  138.   pinMode(Motor3_LEDRGB_Red_PIN_A2, OUTPUT);
  139.   pinMode(Motor3_LEDRGB_Green_PIN_A3, OUTPUT);
  140.   pinMode(Motor3_LEDRGB_Blue_PIN_A4, OUTPUT);
  141.  
  142.   // Turn on status LED (Green) to indicate system ready
  143.   digitalWrite(Motor3_LEDRGB_Green_PIN_A3, HIGH);
  144.  
  145.   // Stop all motors initially
  146.   stopAllMotors();
  147.  
  148.   Serial.println("Robot Control System Initialized");
  149.   Serial.println("Waiting for Bluetooth commands...");
  150. }
  151.  
  152. void loop(void)
  153. {
  154.   // Process incoming Bluetooth commands
  155.   processBluetooth();
  156.  
  157.   // Small delay to prevent overwhelming the processor
  158.   delay(10);
  159. }
  160.  
  161. /****** MOTOR INITIALIZATION FUNCTION *****/
  162. void initializeMotorPins(void)
  163. {
  164.   // Set all motor direction pins as outputs
  165.   pinMode(MOTOR1_DIR_PIN, OUTPUT);
  166.   pinMode(MOTOR2_DIR_PIN, OUTPUT);
  167.   pinMode(MOTOR3_DIR_PIN, OUTPUT);
  168.   pinMode(MOTOR4_DIR_PIN, OUTPUT);
  169.  
  170.   // Set all motor speed (PWM) pins as outputs
  171.   pinMode(MOTOR1_PWM_PIN, OUTPUT);
  172.   pinMode(MOTOR2_PWM_PIN, OUTPUT);
  173.   pinMode(MOTOR3_PWM_PIN, OUTPUT);
  174.   pinMode(MOTOR4_PWM_PIN, OUTPUT);
  175.  
  176.   // Initialize all motor control pins to LOW
  177.   digitalWrite(MOTOR1_DIR_PIN, LOW);
  178.   digitalWrite(MOTOR2_DIR_PIN, LOW);
  179.   digitalWrite(MOTOR3_DIR_PIN, LOW);
  180.   digitalWrite(MOTOR4_DIR_PIN, LOW);
  181.  
  182.   analogWrite(MOTOR1_PWM_PIN, 0);
  183.   analogWrite(MOTOR2_PWM_PIN, 0);
  184.   analogWrite(MOTOR3_PWM_PIN, 0);
  185.   analogWrite(MOTOR4_PWM_PIN, 0);
  186. }
  187.  
  188. /****** BLUETOOTH INITIALIZATION FUNCTION *****/
  189. void initializeBluetooth(void)
  190. {
  191.   // Initialize SoftwareSerial for HC-05 Bluetooth module
  192.   // HC-05 operates at 9600 baud rate by default
  193.   bluetoothSerial.begin(9600);
  194. }
  195.  
  196. /****** BLUETOOTH COMMAND PROCESSING FUNCTION *****/
  197. void processBluetooth(void)
  198. {
  199.   // Check if data is available from Bluetooth
  200.   if (bluetoothSerial.available())
  201.   {
  202.     // Read the incoming command
  203.     char command = bluetoothSerial.read();
  204.    
  205.     // Log received command
  206.     Serial.print("Command received: ");
  207.     Serial.println(command);
  208.    
  209.     // Parse command and extract speed if provided
  210.     uint8_t receivedSpeed = currentSpeed;
  211.    
  212.     // Check if speed data is attached (format: "F:200" for Forward at speed 200)
  213.     if (bluetoothSerial.available() && bluetoothSerial.peek() == CMD_SPEED_SEPARATOR)
  214.     {
  215.       bluetoothSerial.read();  // Consume the ':' separator
  216.       receivedSpeed = 0;
  217.      
  218.       // Read numeric speed value
  219.       while (bluetoothSerial.available() && isDigit(bluetoothSerial.peek()))
  220.       {
  221.         receivedSpeed = (receivedSpeed * 10) + (bluetoothSerial.read() - '0');
  222.       }
  223.      
  224.       // Constrain speed to valid PWM range (0-255)
  225.       if (receivedSpeed > 255)
  226.       {
  227.         receivedSpeed = 255;
  228.       }
  229.      
  230.       currentSpeed = receivedSpeed;
  231.       Serial.print("Speed set to: ");
  232.       Serial.println(currentSpeed);
  233.     }
  234.    
  235.     // Execute movement command based on received command
  236.     switch (command)
  237.     {
  238.       case CMD_FORWARD:
  239.         moveForward(currentSpeed);
  240.         lastCommand = CMD_FORWARD;
  241.         digitalWrite(Motor3_LEDRGB_Green_PIN_A3, HIGH);
  242.         digitalWrite(Motor3_LEDRGB_Red_PIN_A2, LOW);
  243.         Serial.println("Movement: FORWARD");
  244.         break;
  245.        
  246.       case CMD_BACKWARD:
  247.         moveBackward(currentSpeed);
  248.         lastCommand = CMD_BACKWARD;
  249.         digitalWrite(Motor3_LEDRGB_Red_PIN_A2, HIGH);
  250.         digitalWrite(Motor3_LEDRGB_Green_PIN_A3, LOW);
  251.         Serial.println("Movement: BACKWARD");
  252.         break;
  253.        
  254.       case CMD_LEFT:
  255.         moveLeft(currentSpeed);
  256.         lastCommand = CMD_LEFT;
  257.         digitalWrite(Motor3_LEDRGB_Blue_PIN_A4, HIGH);
  258.         digitalWrite(Motor3_LEDRGB_Green_PIN_A3, LOW);
  259.         Serial.println("Movement: LEFT");
  260.         break;
  261.        
  262.       case CMD_RIGHT:
  263.         moveRight(currentSpeed);
  264.         lastCommand = CMD_RIGHT;
  265.         digitalWrite(Motor3_LEDRGB_Blue_PIN_A4, HIGH);
  266.         digitalWrite(Motor3_LEDRGB_Green_PIN_A3, LOW);
  267.         Serial.println("Movement: RIGHT");
  268.         break;
  269.        
  270.       case CMD_STOP:
  271.         stopAllMotors();
  272.         lastCommand = CMD_STOP;
  273.         digitalWrite(Motor3_LEDRGB_Green_PIN_A3, LOW);
  274.         digitalWrite(Motor3_LEDRGB_Red_PIN_A2, LOW);
  275.         digitalWrite(Motor3_LEDRGB_Blue_PIN_A4, LOW);
  276.         Serial.println("Movement: STOP");
  277.         break;
  278.        
  279.       default:
  280.         // Unknown command - do nothing
  281.         Serial.print("Unknown command: ");
  282.         Serial.println(command);
  283.         break;
  284.     }
  285.   }
  286. }
  287.  
  288. /****** FORWARD MOVEMENT FUNCTION *****/
  289. /* SYSTEM REQUIREMENT 3: Forward movement: all 4 motors */
  290. /* rotate in same direction at full speed */
  291. void moveForward(uint8_t speed)
  292. {
  293.   // Motor 1 (Left-Front): Forward
  294.   setMotorSpeed(1, MOTOR_FORWARD, speed);
  295.  
  296.   // Motor 2 (Right-Front): Forward
  297.   setMotorSpeed(2, MOTOR_FORWARD, speed);
  298.  
  299.   // Motor 3 (Left-Rear): Forward
  300.   setMotorSpeed(3, MOTOR_FORWARD, speed);
  301.  
  302.   // Motor 4 (Right-Rear): Forward
  303.   setMotorSpeed(4, MOTOR_FORWARD, speed);
  304. }
  305.  
  306. /****** BACKWARD MOVEMENT FUNCTION *****/
  307. /* SYSTEM REQUIREMENT 4: Backward movement: all 4 motors */
  308. /* rotate in opposite direction at full speed */
  309. void moveBackward(uint8_t speed)
  310. {
  311.   // Motor 1 (Left-Front): Backward
  312.   setMotorSpeed(1, MOTOR_BACKWARD, speed);
  313.  
  314.   // Motor 2 (Right-Front): Backward
  315.   setMotorSpeed(2, MOTOR_BACKWARD, speed);
  316.  
  317.   // Motor 3 (Left-Rear): Backward
  318.   setMotorSpeed(3, MOTOR_BACKWARD, speed);
  319.  
  320.   // Motor 4 (Right-Rear): Backward
  321.   setMotorSpeed(4, MOTOR_BACKWARD, speed);
  322. }
  323.  
  324. /****** LEFT MOVEMENT FUNCTION *****/
  325. /* SYSTEM REQUIREMENT 5: Left movement: left-side motors */
  326. /* reverse, right-side motors forward for strafing motion */
  327. void moveLeft(uint8_t speed)
  328. {
  329.   // Motor 1 (Left-Front): Backward (reverse)
  330.   setMotorSpeed(1, MOTOR_BACKWARD, speed);
  331.  
  332.   // Motor 2 (Right-Front): Forward
  333.   setMotorSpeed(2, MOTOR_FORWARD, speed);
  334.  
  335.   // Motor 3 (Left-Rear): Backward (reverse)
  336.   setMotorSpeed(3, MOTOR_BACKWARD, speed);
  337.  
  338.   // Motor 4 (Right-Rear): Forward
  339.   setMotorSpeed(4, MOTOR_FORWARD, speed);
  340. }
  341.  
  342. /****** RIGHT MOVEMENT FUNCTION *****/
  343. /* SYSTEM REQUIREMENT 6: Right movement: right-side motors */
  344. /* reverse, left-side motors forward for strafing motion */
  345. void moveRight(uint8_t speed)
  346. {
  347.   // Motor 1 (Left-Front): Forward
  348.   setMotorSpeed(1, MOTOR_FORWARD, speed);
  349.  
  350.   // Motor 2 (Right-Front): Backward (reverse)
  351.   setMotorSpeed(2, MOTOR_BACKWARD, speed);
  352.  
  353.   // Motor 3 (Left-Rear): Forward
  354.   setMotorSpeed(3, MOTOR_FORWARD, speed);
  355.  
  356.   // Motor 4 (Right-Rear): Backward (reverse)
  357.   setMotorSpeed(4, MOTOR_BACKWARD, speed);
  358. }
  359.  
  360. /****** STOP ALL MOTORS FUNCTION *****/
  361. /* SYSTEM REQUIREMENT 7: Stop command: halt all motors */
  362. /* immediately */
  363. void stopAllMotors(void)
  364. {
  365.   // Stop all motors by setting speed to 0
  366.   analogWrite(MOTOR1_PWM_PIN, 0);
  367.   analogWrite(MOTOR2_PWM_PIN, 0);
  368.   analogWrite(MOTOR3_PWM_PIN, 0);
  369.   analogWrite(MOTOR4_PWM_PIN, 0);
  370. }
  371.  
  372. /****** SET MOTOR SPEED FUNCTION *****/
  373. /* SYSTEM REQUIREMENT 8: Variable speed control: adjust */
  374. /* motor speed based on Bluetooth data (0-255 PWM) */
  375. void setMotorSpeed(uint8_t motor, uint8_t direction, uint8_t speed)
  376. {
  377.   // Ensure speed is within valid PWM range
  378.   if (speed > 255)
  379.   {
  380.     speed = 255;
  381.   }
  382.  
  383.   // Set direction and speed based on motor number
  384.   switch (motor)
  385.   {
  386.     case 1:  // Motor 1 (Left-Front)
  387.       digitalWrite(MOTOR1_DIR_PIN, direction);
  388.       analogWrite(MOTOR1_PWM_PIN, speed);
  389.       break;
  390.      
  391.     case 2:  // Motor 2 (Right-Front)
  392.       digitalWrite(MOTOR2_DIR_PIN, direction);
  393.       analogWrite(MOTOR2_PWM_PIN, speed);
  394.       break;
  395.      
  396.     case 3:  // Motor 3 (Left-Rear)
  397.       digitalWrite(MOTOR3_DIR_PIN, direction);
  398.       analogWrite(MOTOR3_PWM_PIN, speed);
  399.       break;
  400.      
  401.     case 4:  // Motor 4 (Right-Rear)
  402.       digitalWrite(MOTOR4_DIR_PIN, direction);
  403.       analogWrite(MOTOR4_PWM_PIN, speed);
  404.       break;
  405.      
  406.     default:
  407.       // Invalid motor number - do nothing
  408.       Serial.print("Invalid motor number: ");
  409.       Serial.println(motor);
  410.       break;
  411.   }
  412. }
  413.  
  414. /* END CODE */
  415.  
Advertisement
Comments
  • Geltavek
    7 days
    # CSS 0.85 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 38% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from Swapzone — instant swap).
Add Comment
Please, Sign In to add comment