pleasedontcode

LED Control rev_01

Jul 19th, 2025
371
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: LED Control
  13.     - Source Code NOT compiled for: Arduino Nano ESP32
  14.     - Source Code created on: 2025-07-19 15:21:29
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* turn on led on esp 32 itelf after i press button */
  21.     /* on remotexy */
  22. /****** END SYSTEM REQUIREMENTS *****/
  23.  
  24. /* START CODE */
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. // You need to include the RemoteXY library for the control interface
  28. #include <RemoteXY.h>
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33.  
  34. /* USER CODE START */
  35.  
  36. uint8_t RemoteXY_CONF[] =   // 29 bytes
  37.   { 255,1,0,0,0,22,0,19,0,0,0,0,31,1,106,200,1,1,1,0,
  38.   1,47,67,24,24,0,2,31,0 };
  39.  
  40. // this structure defines all the variables and events of your control interface
  41. struct {
  42.  
  43.     // input variables
  44.   uint8_t button_01; // =1 if button pressed, else =0
  45.  
  46.     // other variable
  47.   uint8_t connect_flag;  // =1 if wire connected, else =0
  48.  
  49. } RemoteXY;  
  50.  
  51. // Define the built-in LED pin for ESP32 (usually GPIO 2)
  52. const int ledPin = 2;
  53.  
  54. /* USER CODE END */
  55.  
  56. void setup(void)
  57. {
  58.   // put your setup code here, to run once:
  59.   RemoteXY_Init(); // Initialize RemoteXY interface
  60.   pinMode(ledPin, OUTPUT); // Initialize the LED pin as output
  61. }
  62.  
  63. void loop(void)
  64. {
  65.   // put your main code here, to run repeatedly:
  66.   RemoteXY_Handler(); // Handle RemoteXY communication
  67.  
  68.   // Turn on LED if button is pressed
  69.   if (RemoteXY.button_01 == 1) {
  70.     digitalWrite(ledPin, HIGH); // Turn on the built-in LED
  71.   } else {
  72.     digitalWrite(ledPin, LOW); // Turn off the built-in LED
  73.   }
  74. }
  75.  
  76. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment