Advertisement
pleasedontcode

Menu_Selection rev_01

Nov 21st, 2023
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Menu_Selection
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-11-22 05:49:12
  15.     - Source Code generated by: Gavin
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20.  
  21. /****** SYSTEM REQUIREMENT 1 *****/
  22. /* Turns led on when start button is pushed */
  23.  
  24. /****** FUNCTION PROTOTYPES *****/
  25. void setup(void);
  26. void loop(void);
  27.  
  28. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  29. const uint8_t Start_LED_PIN = 2;
  30. const uint8_t Start_Button_PIN = 3;
  31.  
  32. void setup(void)
  33. {
  34.   // Set the Start LED pin as an output
  35.   pinMode(Start_LED_PIN, OUTPUT);
  36.  
  37.   // Set the Start Button pin as an input
  38.   pinMode(Start_Button_PIN, INPUT);
  39. }
  40.  
  41. void loop(void)
  42. {
  43.   // Check if the start button is pushed
  44.   if (digitalRead(Start_Button_PIN) == HIGH) {
  45.     // Turn on the Start LED
  46.     digitalWrite(Start_LED_PIN, HIGH);
  47.   } else {
  48.     // Turn off the Start LED
  49.     digitalWrite(Start_LED_PIN, LOW);
  50.   }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement