Advertisement
pleasedontcode

"RGB Control" rev_01

Jun 21st, 2024
412
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: "RGB Control"
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-06-21 13:24:49
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Do all the above */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Arduino.h>
  25.  
  26. /****** FUNCTION PROTOTYPES *****/
  27. void setup(void);
  28. void loop(void);
  29. void updateOutputs(void);
  30.  
  31. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  32. const uint8_t asd_LEDRGB_Red_PIN_D2 = 2;
  33. const uint8_t asd_LEDRGB_Green_PIN_D3 = 3;
  34. const uint8_t asd_LEDRGB_Blue_PIN_D4 = 4;
  35.  
  36. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  37. /***** used to store raw data *****/
  38. bool asd_LEDRGB_Red_PIN_D2_rawData = 0;
  39. bool asd_LEDRGB_Green_PIN_D3_rawData = 0;
  40. bool asd_LEDRGB_Blue_PIN_D4_rawData = 0;
  41.  
  42. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  43. /***** used to store data after characteristic curve transformation *****/
  44. float asd_LEDRGB_Red_PIN_D2_phyData = 0.0;
  45. float asd_LEDRGB_Green_PIN_D3_phyData = 0.0;
  46. float asd_LEDRGB_Blue_PIN_D4_phyData = 0.0;
  47.  
  48. void setup(void)
  49. {
  50.     // put your setup code here, to run once:
  51.     pinMode(asd_LEDRGB_Red_PIN_D2, OUTPUT);
  52.     pinMode(asd_LEDRGB_Green_PIN_D3, OUTPUT);
  53.     pinMode(asd_LEDRGB_Blue_PIN_D4, OUTPUT);
  54. }
  55.  
  56. void loop(void)
  57. {
  58.     // put your main code here, to run repeatedly:
  59.     updateOutputs(); // Refresh output data
  60. }
  61.  
  62. void updateOutputs()
  63. {
  64.     // Update the physical data based on raw data
  65.     asd_LEDRGB_Red_PIN_D2_phyData = asd_LEDRGB_Red_PIN_D2_rawData ? 255.0 : 0.0;
  66.     asd_LEDRGB_Green_PIN_D3_phyData = asd_LEDRGB_Green_PIN_D3_rawData ? 255.0 : 0.0;
  67.     asd_LEDRGB_Blue_PIN_D4_phyData = asd_LEDRGB_Blue_PIN_D4_rawData ? 255.0 : 0.0;
  68.  
  69.     // Write the physical data to the digital pins
  70.     analogWrite(asd_LEDRGB_Red_PIN_D2, asd_LEDRGB_Red_PIN_D2_phyData);
  71.     analogWrite(asd_LEDRGB_Green_PIN_D3, asd_LEDRGB_Green_PIN_D3_phyData);
  72.     analogWrite(asd_LEDRGB_Blue_PIN_D4, asd_LEDRGB_Blue_PIN_D4_phyData);
  73. }
  74.  
  75. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement