Advertisement
pleasedontcode

table rev_01

Dec 4th, 2023
71
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: table
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-12-04 07:57:41
  15.     - Source Code generated by: Gaurav
  16.  
  17. ********* Pleasedontcode.com **********/
  18.  
  19. /****** SYSTEM REQUIREMENTS *****/
  20. /****** SYSTEM REQUIREMENT 1 *****/
  21.     /* when touch sensor is on the turn on led at that */
  22.     /* place there are 20 sensor with different led strip */
  23.     /* connected to it */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. #include <Arduino.h>
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  34. const uint8_t led_LEDRGB_Red_PIN_D2 = 2;
  35. const uint8_t led_LEDRGB_Green_PIN_D3 = 3;
  36. const uint8_t led_LEDRGB_Blue_PIN_D4 = 4;
  37.  
  38. const uint8_t touchSensor_PIN_A0 = A0;
  39.  
  40. void setup(void)
  41. {
  42.     // put your setup code here, to run once:
  43.  
  44.     pinMode(led_LEDRGB_Red_PIN_D2, OUTPUT);
  45.     pinMode(led_LEDRGB_Green_PIN_D3, OUTPUT);
  46.     pinMode(led_LEDRGB_Blue_PIN_D4, OUTPUT);
  47.     pinMode(touchSensor_PIN_A0, INPUT);
  48.  
  49. }
  50.  
  51.  
  52. void loop(void)
  53. {
  54.     // put your main code here, to run repeatedly:
  55.    
  56.     // Check if touch sensor is activated
  57.     if (digitalRead(touchSensor_PIN_A0) == HIGH) {
  58.         // Turn on LED strip
  59.         digitalWrite(led_LEDRGB_Red_PIN_D2, HIGH);
  60.         digitalWrite(led_LEDRGB_Green_PIN_D3, HIGH);
  61.         digitalWrite(led_LEDRGB_Blue_PIN_D4, HIGH);
  62.     } else {
  63.         // Turn off LED strip
  64.         digitalWrite(led_LEDRGB_Red_PIN_D2, LOW);
  65.         digitalWrite(led_LEDRGB_Green_PIN_D3, LOW);
  66.         digitalWrite(led_LEDRGB_Blue_PIN_D4, LOW);
  67.     }
  68. }
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement