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: Arduino Uno - Source Code created on: 2025-11-15 09:55:43 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Develop a program to read input from the Arduino */ /* Uno's digital pin 2, and turn on an LED connected */ /* to digital pin 13 when the button is pressed. */ /****** END SYSTEM REQUIREMENTS *****/ /* START CODE */ // Arduino UNO Input Button and LED Control // Define pin numbers const int buttonPin = 2; // Digital pin connected to the push button const int ledPin = 13; // Digital pin connected to the LED // Variable to store the button state int buttonState = 0; void setup() { // Initialize serial communication: Serial.begin(9600); // Set the button pin as input: pinMode(buttonPin, INPUT); // Set the LED pin as output: pinMode(ledPin, OUTPUT); } void loop() { // Read the state of the pushbutton: buttonState = digitalRead(buttonPin); // Check if the pushbutton is pressed. // If it is, the buttonState is HIGH: if (buttonState == HIGH) { // Turn the LED on: digitalWrite(ledPin, HIGH); } else { // Turn the LED off: digitalWrite(ledPin, LOW); } } /* 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)