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: project12 - Source Code compiled for: Arduino Uno - Source Code created on: 2023-11-21 14:34:49 - Source Code generated by: Mohammad Ayman ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include
#include
/****** SYSTEM REQUIREMENT 1 *****/ /* Turn on the 6 LED Lights when the object is near */ /* 20cm in Ultrasonic sensor and on the 2 Snoozers */ /* also */ /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); void buttonPressed(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t myButton_Pin = 2; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ EasyButton myButton(myButton_Pin); /****** DEFINITION OF LED PINS *****/ const uint8_t ledPin1 = 3; const uint8_t ledPin2 = 4; const uint8_t ledPin3 = 5; const uint8_t ledPin4 = 6; const uint8_t ledPin5 = 7; const uint8_t ledPin6 = 8; /****** DEFINITION OF SNOOZER PINS *****/ const uint8_t snoozerPin1 = 9; const uint8_t snoozerPin2 = 10; void setup(void) { // Initialize Serial for debugging purposes. Serial.begin(115200); // Initialize the button. myButton.begin(); // Set the callback function for button pressed event. myButton.onPressed(buttonPressed); // Set LED pins as output pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(ledPin4, OUTPUT); pinMode(ledPin5, OUTPUT); pinMode(ledPin6, OUTPUT); // Set snoozer pins as output pinMode(snoozerPin1, OUTPUT); pinMode(snoozerPin2, OUTPUT); } void loop(void) { // Read the button state. myButton.read(); // put your main code here, to run repeatedly: } void buttonPressed() { // Turn on the 6 LED Lights when the object is near 20cm in Ultrasonic sensor and the 2 Snoozers also digitalWrite(ledPin1, HIGH); digitalWrite(ledPin2, HIGH); digitalWrite(ledPin3, HIGH); digitalWrite(ledPin4, HIGH); digitalWrite(ledPin5, HIGH); digitalWrite(ledPin6, HIGH); digitalWrite(snoozerPin1, HIGH); digitalWrite(snoozerPin2, HIGH); }
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)