Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: project1_balkar
- - Source Code compiled for: Arduino Mega
- - Source Code created on: 2023-11-09 19:36:39
- - Source Code generated by: Balkar
- ********* Pleasedontcode.com **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <Servo.h>
- /****** SYSTEM REQUIREMENT 1 *****/
- /* turn on or off the motor on push */
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF PWM OUTPUT PINS *****/
- const uint8_t bservo_Servomotor_PWMSignal_PIN_D2 = 2;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- Servo myservo; // Instantiate the Servo object
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(bservo_Servomotor_PWMSignal_PIN_D2, OUTPUT);
- myservo.attach(bservo_Servomotor_PWMSignal_PIN_D2); // Attach the servo to the PWM pin
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- myservo.write(90); // Set the servo angle to 90 degrees
- delay(1000); // Wait for 1 second
- myservo.write(0); // Set the servo angle to 0 degrees
- delay(1000); // Wait for 1 second
- myservo.write(180); // Set the servo angle to 180 degrees
- delay(1000); // Wait for 1 second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement