/********* 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: "Supercar LEDs"
- Source Code NOT compiled for: Arduino Mega
- Source Code created on: 2024-06-11 14:13:16
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* Implement a supercar effect using WS2812_B LED */
/* strip controlled by FastLED library. The setup */
/* involves initializing digital pin 2 for output and */
/* continuously updating the LED state based on raw */
/* data input. */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include //https://github.com/FastLED/FastLED
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void);
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t strip_WS2812B_DIN_PIN_D2 = 2;
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool strip_WS2812B_DIN_PIN_D2_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float strip_WS2812B_DIN_PIN_D2_phyData = 0.0;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
// Number of LEDs in the strip
#define NUM_LEDS 60
// Array of LEDs
CRGB leds[NUM_LEDS];
void setup(void)
{
// put your setup code here, to run once:
pinMode(strip_WS2812B_DIN_PIN_D2, OUTPUT);
// Initialize the LED strip
FastLED.addLeds(leds, NUM_LEDS);
}
void loop(void)
{
// put your main code here, to run repeatedly:
updateOutputs(); // Refresh output data
// Supercar effect: Move a single red LED back and forth along the strip
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Red;
FastLED.show();
delay(30);
leds[i] = CRGB::Black;
}
for (int i = NUM_LEDS - 1; i >= 0; i--) {
leds[i] = CRGB::Red;
FastLED.show();
delay(30);
leds[i] = CRGB::Black;
}
}
void updateOutputs()
{
digitalWrite(strip_WS2812B_DIN_PIN_D2, strip_WS2812B_DIN_PIN_D2_rawData);
}
/* END CODE */