G’day Stephen,
Yep all LEDs confirmed.
I’m just having another crack at it…
The following is compiling OK. but not lighting up LED’s
– sorry, but quite a lot has changed since my previous post.
Just wondering why, given that it is compiling, leds may not be lighting up.
For example, do I have FastLED.show(); in the correct spot?
Thanks again
#include "FastLED.h"
#define DEBUG 0
#define DATA_PIN 9
#define NUM_LEDS_strip 42
#define NUM_LEDS_seg 6
#define LED_TYPE WS2812B // What kind of strip are you using (WS2801, WS2812B or APA102)?
#define COLOR_ORDER GRB // It's GRB for WS2812B and BGR for APA102
// #define LedSegmentMap[][]
// #define SegmentsActive[][]
// int LedSegmentMap[7][6];
struct CRGB leds[NUM_LEDS_strip]; // Initialize our LED array.
int value = 0;
int displayDigit = 6;
int ledFill = 0;
#define RED 0xFF0000
#define GREEN 0x00FF00
#define BLUE 0x0000FF
#define YELLOW 0xFFFF00
#define PINK 0xFF1088
#define ORANGE 0xE05800
#define WHITE 0xFFFFFF
#define OFF 0X000000
/*
*** original
*** from: https://forum.pjrc.com/threads/24927-7-segement-with-rgb-led-strip
#include <OctoWS2811.h>
const int ledsPerStrip = 56;
DMAMEM int displayMemory[ledsPerStrip*6];
int drawingMemory[ledsPerStrip*6];
const int config = WS2811_GRB | WS2811_800kHz;
OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
*/
const int active = 10;
const int state = 7;
int SegementsActive[active][state] = {
{1,1,1,1,1,1,0}, //digit 0
{0,1,1,0,0,0,0}, //digit 1
{1,1,0,1,1,0,1}, //digit 2
{1,1,1,1,0,0,1}, //digit 3
{0,1,1,0,0,1,1}, //digit 4
{1,0,1,1,0,1,1}, //digit 5
{1,0,1,1,1,1,1}, //digit 6
{1,1,1,0,0,0,0}, //digit 7
{1,1,1,1,1,1,1}, //digit 8
{1,1,1,0,0,1,1} //digit 9
};
const int seg = 7;
const int led = 6;
int LedSegmentMap[seg][led] = {
{0,1,2,3,4,5,6},
{7,8,9,10,11,12},
{13,14,15,16,17,18},
{19,20,21,22,23,24},
{25,26,27,28,29,30},
{31,32,33,34,35,36},
{37,38,39,40,41,42}
};
void setup() {
#ifdef DEBUG
Serial.begin(57600);
#endif
LEDS.addLeds<WS2812B, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS_strip); // Set LED strip type
FastLED.setBrightness(85); // Set initial brightness
}
void loop() {
// initLeds();
setLedStatus(displayDigit, BLUE, LedSegmentMap[seg][led]);
FastLED.show();
}
void setLedStatus(int myDigit, int color) {
int ledsPerSeg = 6;
int ledFill = SegmentsActive[active][state];
for (int seg = 0; seg < 6; seg++) {
for (int led = 0; led < ledsPerSeg; led++) {
// orig for OctoWS2811 :: leds.setPixel(LedSegmentMap[digit][seg][led],SegmentsActive[value][seg] ? color : OFF );
// fill_solid( LedSegmentMap[seg][led], ledFill, CRGB::Blue);
// how to use fastled function to light the LED(s)
}
}
// orig octoWS2811:: leds.show();
}
void initLeds() {
for ( int x = 0; x < NUM_LEDS_strip; ++x ) {
leds[0] = CRGB::Black; // initialise strip to black
FastLED.show();
break;
}
}