/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: Humanoid - Source Code compiled for: Arduino Mega - Source Code created on: 2023-11-09 15:05:22 - Source Code generated by: Menaka ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include #include /****** SYSTEM REQUIREMENT 1 *****/ /* Moving Humanoid robot using bluetooth controlled */ /****** SYSTEM REQUIREMENT 2 *****/ /* Moving Humanoid robot using bluetooth controlled */ /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF PWM OUTPUT PINS *****/ const uint8_t V1robo_Servomotor_PWMSignal_PIN_D2 = 2; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ Servo myservo; void setup(void) { // put your setup code here, to run once: myservo.attach(V1robo_Servomotor_PWMSignal_PIN_D2); // Set the serial communication baud rate Serial.begin(9600); } void loop(void) { // put your main code here, to run repeatedly: // Check if there is any data available in the serial buffer if (Serial.available() > 0) { // Read the incoming data char command = Serial.read(); // Move the robot based on the received command switch (command) { case 'F': // Move forward // Set the servo angle to move the robot forward myservo.write(90); break; case 'B': // Move backward // Set the servo angle to move the robot backward myservo.write(180); break; case 'L': // Turn left // Set the servo angle to turn the robot left myservo.write(0); break; case 'R': // Turn right // Set the servo angle to turn the robot right myservo.write(180); break; case 'S': // Stop // Set the servo angle to stop the robot myservo.write(90); break; default: break; } } }