Advertisement
pleasedontcode

"Servo Control" rev_01

Dec 16th, 2023
92
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 Control"
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-12-16 17:05:56
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Servo motor ups and down when the sensor detected */
  21.     /* anything at the front of sensor. */
  22. /****** END SYSTEM REQUIREMENTS *****/
  23.  
  24. /****** DEFINITION OF LIBRARIES *****/
  25. #include <Arduino.h>
  26. #include <Servo.h>
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31.  
  32. /***** DEFINITION OF PWM OUTPUT PINS *****/
  33. const uint8_t Ultrasonicsensor_Servomotor_PWMSignal_PIN_D3 = 3;
  34. const uint8_t Ultrasonicsensor_Servomotor_PWMSignal_PIN_D5 = 5;
  35.  
  36. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  37. Servo servo1;
  38. Servo servo2;
  39.  
  40. void setup(void)
  41. {
  42.   // Attach the servo motors to the PWM output pins
  43.   servo1.attach(Ultrasonicsensor_Servomotor_PWMSignal_PIN_D3);
  44.   servo2.attach(Ultrasonicsensor_Servomotor_PWMSignal_PIN_D5);
  45. }
  46.  
  47. void loop(void)
  48. {
  49.   // put your main code here, to run repeatedly:
  50.  
  51.   // Check if the sensor detects anything at the front
  52.   // of the sensor
  53.   // Add your code here to check the sensor input
  54.  
  55.   // If the sensor detects something, move the servo motors
  56.   // up and down
  57.   // Add your code here to control the servo motors based on
  58.   // the sensor input
  59.  
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement