/********* 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: obstacleavoidingcar - Source Code compiled for: Arduino Uno - Source Code created on: 2023-11-23 07:29:28 - Source Code generated by: jeffrin ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include #include #include /****** SYSTEM REQUIREMENT 1 *****/ /* turn off the light */ const uint8_t lightPin = 9; /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void turnOffLight(); /***** DEFINITION OF PWM OUTPUT PINS *****/ const uint8_t myservo_Servomotor_PWMSignal_PIN_D3 = 3; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ Servo myservo; EasyButton button(2); // Replace 2 with the pin number connected to the button void setup(void) { // put your setup code here, to run once: pinMode(lightPin, OUTPUT); digitalWrite(lightPin, HIGH); // Turn off the light initially pinMode(myservo_Servomotor_PWMSignal_PIN_D3, OUTPUT); myservo.attach(myservo_Servomotor_PWMSignal_PIN_D3); // Initialize button object button.begin(); button.onPressed(turnOffLight); // Call turnOffLight function when button is pressed } void loop(void) { // put your main code here, to run repeatedly: button.read(); // Read button state // Add your other code here } void turnOffLight() { digitalWrite(lightPin, LOW); // Turn off the light }