Hello,
My name is Michael, I'm working on a project for my Cosplay association. I have the codes but I'm struggling a bit.
I managed to put the first code that runs on pin 6 and 7 but I would like (on the same arduino), that a different code runs on pin 8.
Here is the 1st code
#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>
#include <fastled_config.h>
#include <fastled_delay.h>
#include <fastled_progmem.h>
#include <fastpin.h>
#include <fastspi.h>
#include <fastspi_bitbang.h>
#include <fastspi_dma.h>
#include <fastspi_nop.h>
#include <fastspi_ref.h>
#include <fastspi_types.h>
#include <hsv2rgb.h>
#include <led_sysdefs.h>
#include <lib8tion.h>
#include <noise.h>
#include <pixelset.h>
#include <pixeltypes.h>
#include <platforms.h>
#include <power_mgt.h>
// 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 6
#define DATA_PIN1 7
// How many leds in your strip?
#define NUM_LEDS 17
// Define the array of leds
CRGB leds[NUM_LEDS];
//Deuxiem
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.addLeds<WS2812B, DATA_PIN1, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}
void loop() {
// Demarrage
for (int i = 0; i < 2; i++) {
// First slide the led in one direction
for (int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to
leds[i] = CRGB::Blue;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB::Blue;
// Wait a little bit before we loop around and do it again
delay(80);
}
// Now go in the other direction.
for (int i = NUM_LEDS - 1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CRGB::Blue;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB::Blue;
// Wait a little bit before we loop around and do it again
delay(15);
}
}
//Battements de coeur
for (int j = 0; j < 3; j++ ) {
// Fade IN
for (int k = 0; k < 256; k++) {
setAll(0, 0, k);
FastLED.show();
delay(3);
}
// Fade OUT
for (int k = 255; k >= 0; k--) {
setAll(0, 0, k);
FastLED.show();
delay(3);
}
}
}
/**
Default functions
*/
void setAll(byte red, byte green, byte blue) {
for (int i = 0; i < NUM_LEDS; i++ ) {
leds[i] = CRGB(red, green, blue);
}
FastLED.show();
}
Here is the 2nd code
#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>
#include <fastled_config.h>
#include <fastled_delay.h>
#include <fastled_progmem.h>
#include <fastpin.h>
#include <fastspi.h>
#include <fastspi_bitbang.h>
#include <fastspi_dma.h>
#include <fastspi_nop.h>
#include <fastspi_ref.h>
#include <fastspi_types.h>
#include <hsv2rgb.h>
#include <led_sysdefs.h>
#include <lib8tion.h>
#include <noise.h>
#include <pixelset.h>
#include <pixeltypes.h>
#include <platforms.h>
#include <power_mgt.h>
// For led chips like Neopixels, which have a data line, ground, and power, you just
#define DATA_PIN2 8
// How many leds in your strip?
#define NUM_LEDS 77
// Define the array of leds
CRGB leds[NUM_LEDS];
//Deuxiem
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812B, DATA_PIN2, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}
void loop() {
// Demarrage
for (int i = 0; i < 2; i++) {
// First slide the led in one direction
for (int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to
leds[i] = CRGB::Green;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB::Black;
// Wait a little bit before we loop around and do it again
delay(30);
}
// Now go in the other direction.
for (int i = NUM_LEDS - 1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CRGB::Green;
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB::Green;
// Wait a little bit before we loop around and do it again
//delay(30);
}
}
//Battements de coeur
for (int j = 0; j < 3; j++ ) {
// Fade IN
for (int k = 0; k < 256; k++) {
setAll(0, k, 0);
FastLED.show();
delay(1);
}
// Fade OUT
for (int k = 255; k >= 0; k--) {
setAll(0, k, 0);
FastLED.show();
delay(1);
}
}
}
/**
Default functions
*/
void setAll(byte red, byte green, byte blue) {
for (int i = 0; i < NUM_LEDS; i++ ) {
leds[i] = CRGB(red, green, blue);
}
FastLED.show();
}
If you have an idea I'm interested!
Thanks in advance for reading my post :3
Relar