Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: Time Control
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2024-04-27 15:55:14
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* turn on for 30 sec then stop and repeat cycle */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* In a continuous cycle, Turn on LED for 30 seconds */
- /* then stop for 10 seconds */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Servo.h> // https://github.com/arduino-libraries/Servo
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void updateOutputs(void);
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t led_LEDRGB_Red_PIN_D2 = 2;
- /***** DEFINITION OF PWM OUTPUT PINS *****/
- const uint8_t Servo_Servomotor_PWMSignal_PIN_D3 = 3;
- /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
- bool led_LEDRGB_Red_PIN_D2_rawData = 0;
- uint8_t Servo_Servomotor_PWMSignal_PIN_D3_rawData = 0;
- /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
- float led_LEDRGB_Red_PIN_D2_phyData = 0.0;
- float Servo_Servomotor_PWMSignal_PIN_D3_phyData = 0.0;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- Servo myservo; // Create a Servo object
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(led_LEDRGB_Red_PIN_D2, OUTPUT);
- pinMode(Servo_Servomotor_PWMSignal_PIN_D3, OUTPUT);
- myservo.attach(Servo_Servomotor_PWMSignal_PIN_D3); // Attach the Servo object to the PWM pin
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- unsigned long currentMillis = millis();
- if (currentMillis % 40000 < 30000) {
- // Turn on LED for 30 seconds
- led_LEDRGB_Red_PIN_D2_rawData = HIGH;
- } else {
- // Stop LED for 10 seconds
- led_LEDRGB_Red_PIN_D2_rawData = LOW;
- }
- updateOutputs(); // Refresh output data
- }
- void updateOutputs()
- {
- digitalWrite(led_LEDRGB_Red_PIN_D2, led_LEDRGB_Red_PIN_D2_rawData);
- analogWrite(Servo_Servomotor_PWMSignal_PIN_D3, Servo_Servomotor_PWMSignal_PIN_D3_rawData);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement