Advertisement
pleasedontcode

**LED Control** rev_04

Feb 20th, 2025
280
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 Uno
  14.     - Source Code created on: 2025-02-21 00:06:51
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* blynk code */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /* START CODE */
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. #include <Blynk.h>  //https://github.com/blynkkk/blynk-library
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31. void updateOutputs();
  32. void sendDataToBlynk(); // Function to send data to Blynk
  33.  
  34. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  35. const uint8_t myLED_LED_PIN_D2      = 2;
  36.  
  37. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  38. /***** used to store raw data *****/
  39. bool    myLED_LED_PIN_D2_rawData        = 0;
  40.  
  41. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  42. /***** used to store data after characteristic curve transformation *****/
  43. float   myLED_LED_PIN_D2_phyData        = 0.0;
  44.  
  45. /****** BLYNK AUTH TOKEN *****/
  46. char auth[] = "YourBlynkAuthToken"; // Replace with your Blynk Auth Token
  47.  
  48. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  49.  
  50. void setup(void)
  51. {
  52.     // put your setup code here, to run once:
  53.     Blynk.begin(auth); // Initialize Blynk with Auth Token
  54.     pinMode(myLED_LED_PIN_D2, OUTPUT);
  55. }
  56.  
  57. void loop(void)
  58. {
  59.     // put your main code here, to run repeatedly:
  60.     Blynk.run(); // Run Blynk
  61.     updateOutputs(); // Refresh output data
  62.     sendDataToBlynk(); // Send data to Blynk
  63. }
  64.  
  65. void updateOutputs()
  66. {
  67.     digitalWrite(myLED_LED_PIN_D2, myLED_LED_PIN_D2_rawData);
  68. }
  69.  
  70. void sendDataToBlynk()
  71. {
  72.     Blynk.virtualWrite(V0, myLED_LED_PIN_D2_phyData); // Send physical data to virtual pin V0
  73. }
  74.  
  75. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement