/********* 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 compiled for: Arduino Uno
- Source Code created on: 2024-03-20 11:46:52
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* rotate clockwise first */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include // Include the Servo library
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* rotate clockwise first */
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void);
/***** DEFINITION OF PWM OUTPUT PINS *****/
const uint8_t a_Servomotor_PWMSignal_PIN_D3 = 3;
const uint8_t a_Servomotor_PWMSignal_PIN_D5 = 5;
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
uint8_t a_Servomotor_PWMSignal_PIN_D3_rawData = 0;
uint8_t a_Servomotor_PWMSignal_PIN_D5_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float a_Servomotor_PWMSignal_PIN_D3_phyData = 0.0;
float a_Servomotor_PWMSignal_PIN_D5_phyData = 0.0;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
Servo servo_D3; // Create an instance of the Servo class for pin D3
Servo servo_D5; // Create an instance of the Servo class for pin D5
void setup(void)
{
// put your setup code here, to run once:
pinMode(a_Servomotor_PWMSignal_PIN_D3, OUTPUT); // Set pin D3 as output
pinMode(a_Servomotor_PWMSignal_PIN_D5, OUTPUT); // Set pin D5 as output
servo_D3.attach(a_Servomotor_PWMSignal_PIN_D3); // Attach servo_D3 to pin D3
servo_D5.attach(a_Servomotor_PWMSignal_PIN_D5); // Attach servo_D5 to pin D5
servo_D3.write(0); // Rotate servo_D3 clockwise to 0 degrees
servo_D5.write(0); // Rotate servo_D5 clockwise to 0 degrees
delay(1000); // Delay for 1 second
}
void loop(void)
{
// put your main code here, to run repeatedly:
updateOutputs(); // Refresh output data
}
void updateOutputs()
{
servo_D3.write(a_Servomotor_PWMSignal_PIN_D3_rawData); // Set servo_D3 position based on a_Servomotor_PWMSignal_PIN_D3_rawData
servo_D5.write(a_Servomotor_PWMSignal_PIN_D5_rawData); // Set servo_D5 position based on a_Servomotor_PWMSignal_PIN_D5_rawData
}