Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: table
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-04 07:57:41
- - Source Code generated by: Gaurav
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* when touch sensor is on the turn on led at that */
- /* place there are 20 sensor with different led strip */
- /* connected to it */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t led_LEDRGB_Red_PIN_D2 = 2;
- const uint8_t led_LEDRGB_Green_PIN_D3 = 3;
- const uint8_t led_LEDRGB_Blue_PIN_D4 = 4;
- const uint8_t touchSensor_PIN_A0 = A0;
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(led_LEDRGB_Red_PIN_D2, OUTPUT);
- pinMode(led_LEDRGB_Green_PIN_D3, OUTPUT);
- pinMode(led_LEDRGB_Blue_PIN_D4, OUTPUT);
- pinMode(touchSensor_PIN_A0, INPUT);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Check if touch sensor is activated
- if (digitalRead(touchSensor_PIN_A0) == HIGH) {
- // Turn on LED strip
- digitalWrite(led_LEDRGB_Red_PIN_D2, HIGH);
- digitalWrite(led_LEDRGB_Green_PIN_D3, HIGH);
- digitalWrite(led_LEDRGB_Blue_PIN_D4, HIGH);
- } else {
- // Turn off LED strip
- digitalWrite(led_LEDRGB_Red_PIN_D2, LOW);
- digitalWrite(led_LEDRGB_Green_PIN_D3, LOW);
- digitalWrite(led_LEDRGB_Blue_PIN_D4, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement