Hi guys,
This is my first post here so please take it easy on me.
I apologise if my question appears to be dumb and easy for you, I have searched this forum, other forums and the net, but I can't seem to find what I need. I have a little experience with Micro Controllers and RGBs, but not with Neopixels. I may not be using the right words in the searches.
All projects I have done in the past have had the code provided. I have been doing 3D printing for a while now and thought I'd like to put some illumination in my prints.
In a nut shell my project is 3x sections containing 45 pixels each, made from various length pixel strips, wired in series (but each section is routed different) arranged as three No 7 digits (7 L 7).
As I am trying to learn the code I have a 3 stage learning plan, my first goal is to have all three sections display there own sequence (listed in the code), at the same time but in different colours (red, yellow and blue).
After nearly 3 days of trying the closest I have got is they all display the correct colours, but they light up the sections as if it was a single full strip (1 section after the other according to strip direction).
My second goal is to take some of the animations from some of the FastLED examples and run them as a full strip, followed by all 3 sections running my own animation at the same time using there own colour palettes, and with the leds lighting up in pairs, instead of individually .
This is the latest code I have
#include <FastLED.h>
// Set data pin and led count
#define LED_PWR_LIMIT 500 // 500mA limit
#define LED_PIN 7 // data pin
#define NUM_LEDS 135 // single section for testing
#define BRIGHTNESS 50 // brightness level
#define LED_SECTIONS 3 // number of sections in display
CRGB leds [NUM_LEDS]; // initialize all pixels
int section1[ ] = {44,0,43,1,42,2,41,3,40,4,39,5,38,6,37,7,36,8,35,34,33,32,9,31,10,30,11,29,12,28,13,27,14,26,15,25,16,24,17,23,18,22,19,21,20};
int section2[ ] = {79,78,80,77,81,76,82,75,83,74,84,73,85,72,86,71,87,70,88,89,69,45,68,46,67,47,66,48,65,49,64,50,63,51,62,52,61,53,60,54,59,55,58,56,57};
int section3[ ] = {111,110,112,109,113,108,114,107,115,106,116,105,117,104,118,103,119,102,120,121,122,123,101,124,100,125,99,126,98,127,97,128,96,129,95,130,94,131,93,132,92,133,91,134,90};
void setup() {
/*******************************************************************************
************************** only runs once at start-up **************************
*******************************************************************************/
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS); // pixel count, type and data pin
FastLED.setBrightness(BRIGHTNESS); // set brightness level
FastLED.clear();
}
void loop() {
/*******************************************************************************
************************** main code runs repeatedly ***************************
*******************************************************************************/
for(int section1 = 0; section1 < 45; section1++){
leds[section1].setRGB(128, 0, 0);
FastLED.show();
delay (30);
}
for(int section2 = 45; section2 < 90; section2++){
leds[section2].setRGB(128, 128, 0);
FastLED.show();
delay (30);
}
for(int section3 = 90; section3 < 135; section3++){
leds[section3].setRGB(0, 0, 128);
FastLED.show();
delay (30);
}
delay (1000);
FastLED.clear();
}
I have read about the delay function and tried the EVERY_N_MILLISECONDS but could not get that to work either.
I have tried using 'i' instead of 'section1/2/3' in the 'for' loops, this makes all pixels show red.
I have tried to define each section separately, this causes errors with the sections.
I have combined the 'for' loops, doesn't work at all.
I have spent nearly 3 days on this now and seem to be going nowhere.
I know the solution will be easy for some of you but it is a real head scratcher for me.
Please help, with part 1 at least. Parts 2 and 3 would be amazing, although I'm not going to be greedy on my first post.
Here's hoping
All the best and Happy New Year to everyone,
Xant247