Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* 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: Servo Control - Source Code NOT compiled for: Arduino Uno - Source Code created on: 2024-04-27 15:46:03 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* turn on for 30 sec then stop and repeat cycle */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
// https://github.com/arduino-libraries/Servo /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void updateOutputs(void); // Added function prototype for updateOutputs /***** DEFINITION OF PWM OUTPUT PINS *****/ const uint8_t Servo_Servomotor_PWMSignal_PIN_D3 = 3; const uint8_t Servo_Servomotor_PWMSignal_PIN_D5 = 5; /***** DEFINITION OF OUTPUT RAW VARIABLES *****/ uint8_t Servo_Servomotor_PWMSignal_PIN_D3_rawData = 0; uint8_t Servo_Servomotor_PWMSignal_PIN_D5_rawData = 0; /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/ float Servo_Servomotor_PWMSignal_PIN_D3_phyData = 0.0; float Servo_Servomotor_PWMSignal_PIN_D5_phyData = 0.0; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ Servo myservo; // Initializing Servo library object void setup(void) { // put your setup code here, to run once: pinMode(Servo_Servomotor_PWMSignal_PIN_D3, OUTPUT); pinMode(Servo_Servomotor_PWMSignal_PIN_D5, OUTPUT); myservo.attach(Servo_Servomotor_PWMSignal_PIN_D3); // Attaching servo to pin D3 } void loop(void) { // put your main code here, to run repeatedly: updateOutputs(); // Refresh output data // System Requirement 1: Turn on for 30 sec then stop and repeat cycle myservo.write(180); // Turn on the servo to its maximum position delay(30000); // Wait for 30 seconds myservo.write(0); // Stop the servo by setting it to its minimum position delay(1000); // Wait for 1 second before repeating the cycle } void updateOutputs() { analogWrite(Servo_Servomotor_PWMSignal_PIN_D3, Servo_Servomotor_PWMSignal_PIN_D3_rawData); analogWrite(Servo_Servomotor_PWMSignal_PIN_D5, Servo_Servomotor_PWMSignal_PIN_D5_rawData); } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)