/********* 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 compiled for: Arduino Uno - Source Code created on: 2023-12-30 14:41:16 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* when buton is press led on */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include #include /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t menu_PushButton_PIN_D2 = 2; const uint8_t up_PushButton_PIN_D3 = 3; const uint8_t dn_PushButton_PIN_D4 = 4; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ EasyButton menuButton(menu_PushButton_PIN_D2); EasyButton upButton(up_PushButton_PIN_D3); EasyButton downButton(dn_PushButton_PIN_D4); void setup(void) { // put your setup code here, to run once: pinMode(menu_PushButton_PIN_D2, INPUT_PULLUP); pinMode(up_PushButton_PIN_D3, INPUT_PULLUP); pinMode(dn_PushButton_PIN_D4, INPUT_PULLUP); // Initialize EasyButton instances menuButton.begin(); upButton.begin(); downButton.begin(); // Set LED pin as output pinMode(LED_BUILTIN, OUTPUT); } void loop(void) { // put your main code here, to run repeatedly: // Read button states menuButton.read(); upButton.read(); downButton.read(); /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* when button is pressed, turn on LED */ if (menuButton.isPressed()) { digitalWrite(LED_BUILTIN, HIGH); } else { digitalWrite(LED_BUILTIN, LOW); } /****** END SYSTEM REQUIREMENTS *****/ }