Advertisement
pleasedontcode

"Servo Setup" rev_01

Dec 16th, 2023
80
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: "Servo Setup"
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-12-16 10:27:53
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* led red blue */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Arduino.h>
  25. #include <Servo.h>
  26.  
  27. /****** FUNCTION PROTOTYPES *****/
  28. void setup(void);
  29. void loop(void);
  30.  
  31. /***** DEFINITION OF PWM OUTPUT PINS *****/
  32. const uint8_t redLED_PIN = 3;
  33. const uint8_t blueLED_PIN = 5;
  34. const uint8_t servo1_PWMSignal_PIN = 6;
  35.  
  36. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  37. Servo servo1;
  38. Servo servo2;
  39. Servo servo3;
  40.  
  41. void setup(void)
  42. {
  43.   // put your setup code here, to run once:
  44.  
  45.   pinMode(redLED_PIN, OUTPUT);
  46.   pinMode(blueLED_PIN, OUTPUT);
  47.   pinMode(servo1_PWMSignal_PIN, OUTPUT);
  48.  
  49.   servo1.attach(servo1_PWMSignal_PIN);
  50.   servo2.attach(9);
  51.   servo3.attach(10);
  52. }
  53.  
  54. void loop(void)
  55. {
  56.   // put your main code here, to run repeatedly:
  57.  
  58.   // System Requirement 1: Control the red and blue LEDs
  59.   digitalWrite(redLED_PIN, HIGH);
  60.   digitalWrite(blueLED_PIN, LOW);
  61.   delay(1000);
  62.   digitalWrite(redLED_PIN, LOW);
  63.   digitalWrite(blueLED_PIN, HIGH);
  64.   delay(1000);
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement