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: LED Control - Source Code NOT compiled for: Arduino Uno - Source Code created on: 2024-11-02 06:30:47 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* control red led connecter to pin D2 , the led */ /* switch on 2second then switch off after that the */ /* second green led switch on then wait 2 second then */ /* switch off */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void updateOutputs(void); /***** DEFINITION OF DIGITAL OUTPUT PINS *****/ const uint8_t led_LED_PIN_D2 = 2; // Red LED connected to pin D2 const uint8_t green_led_LED_PIN_D3 = 3; // Green LED connected to pin D3 /***** DEFINITION OF OUTPUT RAW VARIABLES *****/ /***** used to store raw data *****/ bool led_LED_PIN_D2_rawData = 0; // Initial state for Red LED bool green_led_LED_PIN_D3_rawData = 0; // Initial state for Green LED /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/ /***** used to store data after characteristic curve transformation *****/ float led_LED_PIN_D2_phyData = 0.0; float green_led_LED_PIN_D3_phyData = 0.0; void setup(void) { // Initialize the digital pins as outputs pinMode(led_LED_PIN_D2, OUTPUT); pinMode(green_led_LED_PIN_D3, OUTPUT); } void loop(void) { // Control the Red LED led_LED_PIN_D2_rawData = true; // Turn on Red LED updateOutputs(); // Refresh output data delay(2000); // Wait for 2 seconds led_LED_PIN_D2_rawData = false; // Turn off Red LED updateOutputs(); // Refresh output data // Control the Green LED green_led_LED_PIN_D3_rawData = true; // Turn on Green LED updateOutputs(); // Refresh output data delay(2000); // Wait for 2 seconds green_led_LED_PIN_D3_rawData = false; // Turn off Green LED updateOutputs(); // Refresh output data delay(2000); // Wait for 2 seconds } void updateOutputs() { // Update the state of the LEDs digitalWrite(led_LED_PIN_D2, led_LED_PIN_D2_rawData); digitalWrite(green_led_LED_PIN_D3, green_led_LED_PIN_D3_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)