Advertisement
pleasedontcode

NeoPixel Control rev_01

May 3rd, 2024
597
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: NeoPixel Control
  13.     - Source Code NOT compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-05-03 10:31:15
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* 200 leds on the string that need to be preety */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Adafruit_NeoPixel.h>
  25.  
  26. /****** FUNCTION PROTOTYPES *****/
  27. void setup(void);
  28. void loop(void);
  29. void updateOutputs();
  30.  
  31. /***** DEFINITION OF PWM OUTPUT PINS *****/
  32. const uint8_t Led_ws2812b_PIN_D4 = 4;
  33.  
  34. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  35. uint8_t Led_ws2812b_PIN_D4_rawData = 0;
  36.  
  37. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  38. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(200, Led_ws2812b_PIN_D4, NEO_GRB + NEO_KHZ800);
  39.  
  40. void setup(void)
  41. {
  42.   // put your setup code here, to run once:
  43.   pinMode(Led_ws2812b_PIN_D4, OUTPUT);
  44.   pixels.begin(); // Initialize NeoPixel strip
  45. }
  46.  
  47. void loop(void)
  48. {
  49.   // put your main code here, to run repeatedly:
  50.   updateOutputs(); // Refresh output data
  51. }
  52.  
  53. void updateOutputs()
  54. {
  55.   // Update NeoPixel strip with the raw data
  56.   for (int i = 0; i < pixels.numPixels(); i++) {
  57.     pixels.setPixelColor(i, Led_ws2812b_PIN_D4_rawData, 0, 0); // Set color based on raw data
  58.   }
  59.   pixels.show(); // Display the updated NeoPixel strip
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement