Advertisement
pleasedontcode

project1_balkar rev_01

Nov 9th, 2023
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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: project1_balkar
  13.     - Source Code compiled for: Arduino Mega
  14.     - Source Code created on: 2023-11-09 19:36:39
  15.     - Source Code generated by: Balkar
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <Servo.h>
  21.  
  22. /****** SYSTEM REQUIREMENT 1 *****/
  23. /* turn on or off the motor on push */
  24.  
  25. /****** FUNCTION PROTOTYPES *****/
  26. void setup(void);
  27. void loop(void);
  28.  
  29. /***** DEFINITION OF PWM OUTPUT PINS *****/
  30. const uint8_t bservo_Servomotor_PWMSignal_PIN_D2 = 2;
  31.  
  32. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  33. Servo myservo; // Instantiate the Servo object
  34.  
  35. void setup(void)
  36. {
  37.   // put your setup code here, to run once:
  38.   pinMode(bservo_Servomotor_PWMSignal_PIN_D2, OUTPUT);
  39.   myservo.attach(bservo_Servomotor_PWMSignal_PIN_D2); // Attach the servo to the PWM pin
  40. }
  41.  
  42. void loop(void)
  43. {
  44.   // put your main code here, to run repeatedly:
  45.   myservo.write(90); // Set the servo angle to 90 degrees
  46.   delay(1000); // Wait for 1 second
  47.  
  48.   myservo.write(0); // Set the servo angle to 0 degrees
  49.   delay(1000); // Wait for 1 second
  50.  
  51.   myservo.write(180); // Set the servo angle to 180 degrees
  52.   delay(1000); // Wait for 1 second
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement