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: ESP32 DevKit V1 - Source Code created on: 2025-11-15 10:02:29 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Utilize the ESP32 DevKit V1's GPIO pins to control */ /* an onboard LED and read input from a connected */ /* push button, enabling basic user interaction. */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ // Include the Arduino core library #include
// Define GPIO pins for onboard LED and push button const int onboardLedPin = 2; // Onboard LED pin for ESP32 DevKit V1 const int pushButtonPin = 0; // Connected push button pin (change if different) // Variable to store button state int buttonState = 0; void setup() { // Initialize serial communication at 115200 baud rate Serial.begin(115200); // Initialize the onboard LED pin as output pinMode(onboardLedPin, OUTPUT); // Initialize the push button pin as input with internal pull-up resistor pinMode(pushButtonPin, INPUT_PULLUP); } void loop() { // Read the state of the push button buttonState = digitalRead(pushButtonPin); // Check if button is pressed (active low) if (buttonState == LOW) { // Turn on the onboard LED digitalWrite(onboardLedPin, HIGH); } else { // Turn off the onboard LED digitalWrite(onboardLedPin, LOW); } // Small delay for debounce and stability delay(10); } /* 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)