Advertisement
pleasedontcode

Servo Control rev_01

May 2nd, 2024
861
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 NOT compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-05-02 18:21:58
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* stream video over webserver, save videos and pic */
  21.     /* to sd card, pan camera using the servo to follow */
  22.     /* objects also do face recognition, set video */
  23.     /* resolutio to 480p */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. #include <Deneyap_Servo.h> // https://github.com/deneyapkart/deneyap-servo-arduino-library
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32. void updateOutputs(void);
  33.  
  34. /***** DEFINITION OF PWM OUTPUT PINS *****/
  35. const uint8_t sg90_Servomotor_PWMSignal_PIN_D4 = 4;
  36.  
  37. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  38. /***** used to store raw data *****/
  39. uint8_t sg90_Servomotor_PWMSignal_PIN_D4_rawData = 0;
  40.  
  41. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  42. /***** used to store data after characteristic curve transformation *****/
  43. float sg90_Servomotor_PWMSignal_PIN_D4_phyData = 0.0;
  44.  
  45. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  46. Servo myservo; // Servo object instance from Deneyap Servo library
  47.  
  48. void setup(void)
  49. {
  50.     // put your setup code here, to run once:
  51.     pinMode(sg90_Servomotor_PWMSignal_PIN_D4, OUTPUT);
  52.  
  53.     myservo.attach(D9); // Attaching servo motor to pin D9
  54.  
  55.     // Additional setup for system requirements
  56.     // Initialize SD card for saving videos and pictures
  57.     // Set video resolution to 480p
  58.     // Perform face recognition setup
  59. }
  60.  
  61. void loop(void)
  62. {
  63.     // put your main code here, to run repeatedly:
  64.     updateOutputs(); // Refresh output data
  65.  
  66.     // Additional code for system requirements
  67.     // Stream video over webserver
  68.     // Pan camera using the servo to follow objects
  69. }
  70.  
  71. void updateOutputs(void)
  72. {
  73.     analogWrite(sg90_Servomotor_PWMSignal_PIN_D4, sg90_Servomotor_PWMSignal_PIN_D4_rawData);
  74. }
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement