Help with Code Complete Newbie here.**FIXED/SOLVED**

Hello all,

I'm trying to create a LED show for my 3-year-old that scrolls through the alphabet and change colors to help teach him letters/colors.

I'm using an Eelegoo Uno R3
a BTF-lighting WS2812B RGB 5050SMD individually addressable Digital 16x16 256 pixels "led pannel"

Below is my code, which I know is wrong. When I run the program, it will show both A in red & B in Blue. I'd like it to display the letter A, wait a Minute or Two have it display the letter B & so on. I'm missing out or unsure where to find the code I need to enter to do this.

Any assistance is much appreciated if there's an easier way to code this or a cheat sheet please let me know.

Thank you.

*** Code**

#include <FastLED.h>
#define NUM_LEADS 256
#define DATA_PIN 8
int delayTime= 1000;
CRGB strip1[NUM_LEADS];

void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(strip1, NUM_LEADS);
FastLED.setBrightness(50);
}

void loop() {
// put your main code here, to run repeatedly:

strip1[199] = CRGB (255, 0, 0);
strip1[200] = CRGB (255, 0, 0);
strip1[184] = CRGB (255, 0, 0);
strip1[183] = CRGB (255, 0, 0);
strip1[165] = CRGB (255, 0, 0);
strip1[166] = CRGB (255, 0, 0);
strip1[169] = CRGB (255, 0, 0);
strip1[170] = CRGB (255, 0, 0);
strip1[155] = CRGB (255, 0, 0);
strip1[154] = CRGB (255, 0, 0);
strip1[149] = CRGB (255, 0, 0);
strip1[148] = CRGB (255, 0, 0);
strip1[131] = CRGB (255, 0, 0);
strip1[132] = CRGB (255, 0, 0);
strip1[133] = CRGB (255, 0, 0);
strip1[134] = CRGB (255, 0, 0);
strip1[135] = CRGB (255, 0, 0);
strip1[136] = CRGB (255, 0, 0);
strip1[137] = CRGB (255, 0, 0);
strip1[138] = CRGB (255, 0, 0);
strip1[139] = CRGB (255, 0, 0);
strip1[140] = CRGB (255, 0, 0);
strip1[125] = CRGB (255, 0, 0);
strip1[124] = CRGB (255, 0, 0);
strip1[115] = CRGB (255, 0, 0);
strip1[114] = CRGB (255, 0, 0);
strip1[97] = CRGB (255, 0, 0);
strip1[98] = CRGB (255, 0, 0);
strip1[109] = CRGB (255, 0, 0);
strip1[110] = CRGB (255, 0, 0);
strip1[95] = CRGB (255, 0, 0);
strip1[94] = CRGB (255, 0, 0);
strip1[81] = CRGB (255, 0, 0);
strip1[80] = CRGB (255, 0, 0);
strip1[64] = CRGB (255, 0, 0);
strip1[79] = CRGB (255, 0, 0);

delay(delayTime);

strip1[252] = CRGB (0, 0, 255);
strip1[251] = CRGB (0, 0, 255);
strip1[277] = CRGB (0, 0, 255);
strip1[229] = CRGB (0, 0, 255);
strip1[220] = CRGB (0, 0, 255);
strip1[217] = CRGB (0, 0, 255);
strip1[195] = CRGB (0, 0, 255);
strip1[199] = CRGB (0, 0, 255);
strip1[188] = CRGB (0, 0, 255);
strip1[183] = CRGB (0, 0, 255);
strip1[163] = CRGB (0, 0, 255);
strip1[167] = CRGB (0, 0, 255);
strip1[156] = CRGB (0, 0, 255);
strip1[153] = CRGB (0, 0, 255);
strip1[131] = CRGB (0, 0, 255);
strip1[133] = CRGB (0, 0, 255);
strip1[124] = CRGB (0, 0, 255);
strip1[123] = CRGB (0, 0, 255);
strip1[99] = CRGB (0, 0, 255);
strip1[101] = CRGB (0, 0, 255);
strip1[92] = CRGB (0, 0, 255);
strip1[89] = CRGB (0, 0, 255);
strip1[67] = CRGB (0, 0, 255);
strip1[71] = CRGB (0, 0, 255);
strip1[60] = CRGB (0, 0, 255);
strip1[55] = CRGB (0, 0, 255);
strip1[35] = CRGB (0, 0, 255);
strip1[39] = CRGB (0, 0, 255);
strip1[28] = CRGB (0, 0, 255);
strip1[25] = CRGB (0, 0, 255);
strip1[3] = CRGB (0, 0, 255);
strip1[4] = CRGB (0, 0, 255);
strip1[5] = CRGB (0, 0, 255);

delay(delayTime);
FastLED.show();

}

Try putting

FastLED.show();

Immediately before the delay in the middle then again immediately before the delay at the end.

If that doesn't do it then I don't know.

Along with Perry's suggestion, before displaying either letter you should clear the previous value in all of the outputs by writing zero to them. This is best done by creating a function to do it and calling it when required. Then you only need to write the required colour to the pixels to be lit for a particular letter.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

Hi notthecodeking,

maybe you are doing all those things that I will describe below. If yes congratulations to the way you are raising your child.

The microcontrollerworld is not superstandardized like USB-devices. You have to take care of more details than just "does the plug fit into the socket" The "cheat-sheet" is to search for a library that makes driving a 16x16 matrix more comfortable.

If something like this is not available then you have to determine the position of each LEDs
are they are organised as rows
01 02 03 04 05 06 07 08 09 00 01 02 03 04 05 06
11 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16

or as columms
00 01 02 03
10 11 12 13
etc.

anyway your 3 year-old child does not need 2D-flat screens. It needs as much as possible 3D-real-world-objects to take in its own hands and to learn from that.

if your 3-year-old child can train its brain just with 2D-flat-pictures his Perceptual system will be crippled in a way that makes learning harder for the rest of his life. As a 3-year-old child his perceptual system is tsill developing. And in this age it should have the most richest sensory impressions it could have. Of course not overwhelming all the time. But In reasonable dosage.

I have seen so many childs at the age of around 14 that are unable to put a nut on a bolt or are unable to walk backwards. We are not living in a "MATRIX" we are living in a real 3D-World and this needs all the rich 3D-World-experience you have had as a child playing in the garden, tinkering with sand, wooden blocks, Lego, clay playing imaginery games "we are on high stormy sea" in a self painted carton as the ship etc. etc.

For learning reading some years ago I came across a method called word building.
You have cards with single letters on them putting words together letter for letter always saing what is build

example with the word "table"

"T" saying "T"
"TA" saying "TA"
"TAB" saying "TAB"
"TABL" saying "TABL"

"TABLE" saying "TABLE"
and then backwards taking the letters away one by one again

The primary teacher who developed this method said in here 18 years of teaching learing to read with this method she had not a single case of a child with a weak read/spelling disability.

here is a link that I found by googling
https://www.lilreadingscientists.com/word-building-as-a-tool/

Again I want to emphsasize I recommend doing all this with real 3D-objects
best regards Stefan

Thank you all for the suggestions wish I thought of the notthecodeking user name haha :smiley: anyways.
I will look into the link you put Stefan great thing about the "flashcards" I can create that exact example. with Table as it slowly displays each one. lights are his attention-getter.

I did was exactly what Perry Stated, as well as UKHelibob.

Thank you for the help now time to code the rest of the alphabet.
I've attached a diagram of how the LED's are arranged FYI
I have this in word and blacken each box to see which LED's I need to turn on. maybe this will help a fellow newbie.

here is the code I created for it to work see Tom I read your post :smiley:

#include <FastLED.h>
#define NUM_LEADS 256
#define DATA_PIN 8
int delayTime= 3000;
CRGB strip1[NUM_LEADS];





void setup() {
  // put your setup code here, to run once:
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(strip1, NUM_LEADS);
FastLED.setBrightness(50);

}

void loop() {
  // put your main code here, to run repeatedly:

strip1[199] = CRGB (255, 0, 0);
strip1[200] = CRGB (255, 0, 0);
strip1[184] = CRGB (255, 0, 0);
strip1[183] = CRGB (255, 0, 0);
strip1[165] = CRGB (255, 0, 0);
strip1[166] = CRGB (255, 0, 0);
strip1[169] = CRGB (255, 0, 0);
strip1[170] = CRGB (255, 0, 0);
strip1[155] = CRGB (255, 0, 0);
strip1[154] = CRGB (255, 0, 0);
strip1[149] = CRGB (255, 0, 0);
strip1[148] = CRGB (255, 0, 0);
strip1[131] = CRGB (255, 0, 0);
strip1[132] = CRGB (255, 0, 0);
strip1[133] = CRGB (255, 0, 0);
strip1[134] = CRGB (255, 0, 0);
strip1[135] = CRGB (255, 0, 0);
strip1[136] = CRGB (255, 0, 0);
strip1[137] = CRGB (255, 0, 0);
strip1[138] = CRGB (255, 0, 0);
strip1[139] = CRGB (255, 0, 0);
strip1[140] = CRGB (255, 0, 0);
strip1[125] = CRGB (255, 0, 0);
strip1[124] = CRGB (255, 0, 0);
strip1[115] = CRGB (255, 0, 0);
strip1[114] = CRGB (255, 0, 0);
strip1[97] = CRGB (255, 0, 0);
strip1[98] = CRGB (255, 0, 0);
strip1[109] = CRGB (255, 0, 0);
strip1[110] = CRGB (255, 0, 0);
strip1[95] = CRGB (255, 0, 0);
strip1[94] = CRGB (255, 0, 0);
strip1[81] = CRGB (255, 0, 0);
strip1[80] = CRGB (255, 0, 0);
strip1[64] = CRGB (255, 0, 0);
strip1[79] = CRGB (255, 0, 0);

FastLED.show();
FastLED.clear();
delay(delayTime);

strip1[252] = CRGB (0, 0, 255);
strip1[251] = CRGB (0, 0, 255);
strip1[277] = CRGB (0, 0, 255);
strip1[229] = CRGB (0, 0, 255);
strip1[220] = CRGB (0, 0, 255);
strip1[217] = CRGB (0, 0, 255);
strip1[195] = CRGB (0, 0, 255);
strip1[199] = CRGB (0, 0, 255);
strip1[188] = CRGB (0, 0, 255);
strip1[183] = CRGB (0, 0, 255);
strip1[163] = CRGB (0, 0, 255);
strip1[167] = CRGB (0, 0, 255);
strip1[156] = CRGB (0, 0, 255);
strip1[153] = CRGB (0, 0, 255);
strip1[131] = CRGB (0, 0, 255);
strip1[133] = CRGB (0, 0, 255);
strip1[124] = CRGB (0, 0, 255);
strip1[123] = CRGB (0, 0, 255);
strip1[99] = CRGB (0, 0, 255);
strip1[101] = CRGB (0, 0, 255);
strip1[92] = CRGB (0, 0, 255);
strip1[89] = CRGB (0, 0, 255);
strip1[67] = CRGB (0, 0, 255);
strip1[71] = CRGB (0, 0, 255);
strip1[60] = CRGB (0, 0, 255);
strip1[55] = CRGB (0, 0, 255);
strip1[35] = CRGB (0, 0, 255);
strip1[39] = CRGB (0, 0, 255);
strip1[28] = CRGB (0, 0, 255);
strip1[25] = CRGB (0, 0, 255);
strip1[3] = CRGB (0, 0, 255);
strip1[4] = CRGB (0, 0, 255);
strip1[5] = CRGB (0, 0, 255);

FastLED.show();
FastLED.clear();
delay(delayTime);


}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.