As you already know we can use Fast LEDs as an indicator. Now let us explore possibility to use the Fast LED strips as a display to show some graphics.
You can use them to display the directions of the road, counters, names, table numbers at restaurants, also funny messages! :D
As a first step we will do a cylon pattern of LEDs. For a beginner or other wise Wokwi Arduino simulator is the best place to try your design and bring them it into reality before you actually start using your hardware. Keep watching this space for more details
Connection diagram#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 64
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 7
#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
LEDS.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
LEDS.setBrightness(84);
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t hue = 0;
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
Serial.print("x");
// Now go in the other direction.
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
}
You can also find the code in the link below with the simulation. Here you can also explore and try your hands at making a pattern of your choice.
https://wokwi.com/arduino/libraries/FastLED/Cylon
Support/questions?I will be glad to hear from you😀. Please drop your comments below👍. If you would love to hear more about the simulators, please feel free to hop into the Wokwi Discord Channel!
Share your interesting projects and browse through several curious projects from fellow developers and makers on Facebook Wokwi Group!
Stay Safe!
Don't stop learning!
#wokwimakes
Stay Safe!
Don't stop learning!
#wokwimakes
Comments