/********* 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: Button-controlled LEDs
- Source Code compiled for: Arduino Uno
- Source Code created on: 2023-12-07 03:27:58
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* Led my project */
/****** SYSTEM REQUIREMENT 2 *****/
/* Led my project */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
const uint8_t Led_Pin_1 = 3; // Replace with the actual pin number for LED 1
/****** SYSTEM REQUIREMENT 2 *****/
const uint8_t Led_Pin_2 = 4; // Replace with the actual pin number for LED 2
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
EasyButton button(2); // Replace with the actual pin number for the button
void setup(void)
{
pinMode(Led_Pin_1, OUTPUT);
pinMode(Led_Pin_2, OUTPUT);
button.begin();
}
void loop(void)
{
button.read();
// Check button state
if (button.isPressed()) {
digitalWrite(Led_Pin_1, HIGH); // Turn on LED 1
} else {
digitalWrite(Led_Pin_1, LOW); // Turn off LED 1
}
// Check button state and duration pressed
if (button.pressedFor(1000)) {
digitalWrite(Led_Pin_2, HIGH); // Turn on LED 2
} else {
digitalWrite(Led_Pin_2, LOW); // Turn off LED 2
}
}