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 LED - Source Code compiled for: Arduino Nano - Source Code created on: 2024-03-11 21:29:48 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* if klik_PushButton pressed for greater tan 100 on */ /* 500 millisecond and klik2_PushBUtton pressed */ /* greater than 3 times on 500 millisecond */ /* digitalwrite pinled high */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/evert-arias/EasyButton /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void updateOutputs(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t klik_PushButton_PIN_D2 = 2; const uint8_t klik2_PushButton_PIN_D3 = 3; /***** DEFINITION OF DIGITAL OUTPUT PINS *****/ const uint8_t pinled_LED_PIN_D4 = 4; /***** DEFINITION OF OUTPUT RAW VARIABLES *****/ /***** used to store raw data *****/ bool pinled_LED_PIN_D4_rawData = 0; /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/ /***** used to store data after characteristic curve transformation *****/ float pinled_LED_PIN_D4_phyData = 0.0; // Instances of button objects EasyButton klik_PushButton(klik_PushButton_PIN_D2); EasyButton klik2_PushButton(klik2_PushButton_PIN_D3); void setup(void) { // put your setup code here, to run once: pinMode(klik_PushButton_PIN_D2, INPUT_PULLUP); pinMode(klik2_PushButton_PIN_D3, INPUT_PULLUP); pinMode(pinled_LED_PIN_D4, OUTPUT); // Initialize the buttons klik_PushButton.begin(); klik2_PushButton.begin(); } void loop(void) { // put your main code here, to run repeatedly: updateOutputs(); // Refresh output data // Continuously read the status of the buttons klik_PushButton.read(); klik2_PushButton.read(); // Check if the buttons are pressed for a certain duration if (klik_PushButton.pressedFor(500) && klik2_PushButton.pressedFor(500)) { digitalWrite(pinled_LED_PIN_D4, HIGH); } else { digitalWrite(pinled_LED_PIN_D4, LOW); } } void updateOutputs(void) { digitalWrite(pinled_LED_PIN_D4, pinled_LED_PIN_D4_rawData); }
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)