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 Control - Source Code compiled for: Arduino Uno - Source Code created on: 2024-03-11 11:24:38 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* I want to use two relays for the left and right of */ /* a tilt motor. Inside this motor, there is a 10 */ /* kOhm potentiometer, which changes the position of */ /* this motor according to the command that is being */ /* executed. I will divide the right side of this */ /* engin */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
//https://github.com/evert-arias/EasyButton /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t Btn1_PushButton_PIN_D2 = 2; const uint8_t Btn2_PushButton_PIN_D3 = 3; /***** DEFINITION OF ANALOG INPUT PINS *****/ const uint8_t Pot_Potentiometer_Vout_PIN_A0 = A0; /****** DEFINITION OF LIBRARY CLASS INSTANCES*****/ EasyButton Btn1_PushButton(Btn1_PushButton_PIN_D2); EasyButton Btn2_PushButton(Btn2_PushButton_PIN_D3); void setup(void) { // put your setup code here, to run once: pinMode(Btn1_PushButton_PIN_D2, INPUT_PULLUP); pinMode(Btn2_PushButton_PIN_D3, INPUT_PULLUP); pinMode(Pot_Potentiometer_Vout_PIN_A0, INPUT); } void loop(void) { // put your main code here, to run repeatedly: // Check the state of Btn1_PushButton Btn1_PushButton.read(); if (Btn1_PushButton.isPressed()) { // Perform the left tilt motor action } // Check the state of Btn2_PushButton Btn2_PushButton.read(); if (Btn2_PushButton.isPressed()) { // Perform the right tilt motor action } // Read the value of the potentiometer int potValue = analogRead(Pot_Potentiometer_Vout_PIN_A0); // Perform actions based on the potentiometer value }
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)