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: Button Control - Source Code NOT compiled for: Arduino Nano - Source Code created on: 2024-04-25 11:41:27 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Ensure LED diode turns on for 50ms after pressing */ /* the EasyButton. It should turn off after 50ms, */ /* even if the button is still pressed. Allow */ /* reactivation only after a 2s delay. */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
EasyButton button(Przycisk_PushButton_PIN_D2); // Initialize EasyButton with pin 2 unsigned long lastDebounceTime = 0; unsigned long debounceDelay = 50; unsigned long reactivateDelay = 2000; bool ledState = LOW; bool buttonState = LOW; void setup(void) { // put your setup code here, to run once: pinMode(Przycisk_PushButton_PIN_D2, INPUT_PULLUP); pinMode(Zawor_LED_PIN_D3, OUTPUT); button.begin(); // Initialize EasyButton } void loop(void) { // put your main code here, to run repeatedly: button.read(); // Read the state of the button if (button.isPressed()) { if (millis() - lastDebounceTime > debounceDelay) { lastDebounceTime = millis(); ledState = HIGH; digitalWrite(Zawor_LED_PIN_D3, ledState); delay(50); ledState = LOW; digitalWrite(Zawor_LED_PIN_D3, ledState); delay(reactivateDelay); } } } /* 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)