Two sketches. One works, one doesn't.

Ok, I am going to have to cop this.

I am working on a clock.

The first code I wrote is ok.
It works.
I see the initial setup on the serial port.

I am trying to change the code to make arrays for the values.

The new code HANGS.

I don't even get the initial setup on the serial port.
V5 works.
V6 doesn't.

And yes there is a lot of crap in 6, but it is outside the loop and "sectioned off".
There are no compile errors, but it just hangs.

I don't get it.
(Sorry, now both files included.)

LED_Clock6.ino (9.73 KB)

LED_Clock5.ino (8.47 KB)

LED_Clock6.ino (9.73 KB)

The arrays add about 1500 bytes to your RAM usage. You are probably exceeding the available ram.

Pete

El supremo.

Thanks.

I can't say.

When I compile it I get:
Binary sketch size: 9,070 bytes (of a 32,256 byte maximum)

So could you help me understand why?

Or could you help me with what I am trying to do?
I'm using arrays to supposedly make it easier to "merge" the colours when the hands overlap.

I just took out the X_R, B and B part and it works.

But I get a whole ring of BLUE ONLY leds.

The Binary sketch size is the amount of flash taken up by the code. It is not the same as the sram which holds local variables and the stack. Unfortunately, the Arduino IDE doesn't report sram usage. Just as a test you could try defining LED_Loop to be 30 or 10, to see if the loop even starts up.
If it does at least start up you can be sure it's the array size that is causing the problem. In that event, you are probably up the creek unless you can write the code to use smaller, or fewer, arrays.
The libraries always use up some sram and NeoPixel in particular might need a fair bit and there's little you can do about that.

Pete

Yes, I have worked that out.
(See last part of other post. It was a PS addition)

Given that, I am still a bit confused.

The time units (hours, minutes and seconds) are got, hours "converted" to better represent the hour hand position.

Their colours are set in their arrays, yet all I am getting is a blue circle of LEDs. Slowly starting off all turned off, and turning on one by one as the minute goes by until they are all on.

Ok, that is probably me and the code: Not turning them off.

But why aren't the minutes and hours showing up?

Ah!

Found a big problem.

I had:

     strip.setPixelColor(copy_count,H_R[copy_count]|M_R[copy_count]|S_R[copy_count]|X_R[copy_count]);
     strip.setPixelColor(copy_count,H_G[copy_count]|M_G[copy_count]|S_G[copy_count]|X_G[copy_count]);
     strip.setPixelColor(copy_count,H_B[copy_count]|M_B[copy_count]|S_B[copy_count]|X_B[copy_count]);

When I should have had:

strip.setPixelColor(copy_count,H_R[copy_count]|M_R[copy_count]|S_R[copy_count],H_G[copy_count]|M_G[copy_count]|S_G[copy_count],H_B[copy_count]|M_B[copy_count]|S_B[copy_count] );

Now for the fun of the extra stuff.

I've modified my code to this:

   copy_count = 0;
   while (copy_count <LED_Loop)
   {
     //
     A_R = H_R[copy_count]|M_R[copy_count]|S_R[copy_count];
     A_G = H_G[copy_count]|M_G[copy_count]|S_G[copy_count];
     A_B = H_B[copy_count]|M_B[copy_count]|S_B[copy_count];
     strip.setPixelColor(copy_count,A_R,A_G,A_B);

Interesting that when the SECOND hand moves over the HOUR hand, the LED goes PINK/MAGENTA. (RED + BLUE)
However, when the SECOND hand goes over the MINUTE hand, it stays BLUE!

Now, another thing which is happening is that as the minutes tick over, the OLD minute is not "turned off".

To get around that - or so I thought I did this:

   copy_count = 0;
   while (copy_count <LED_Loop)
   {
     strip.setPixelColor(copy_count,0x000000);
     copy_count++;
   }

   copy_count = 0;
   while (copy_count <LED_Loop)
   {
     //
     A_R = H_R[copy_count]|M_R[copy_count]|S_R[copy_count];
     A_G = H_G[copy_count]|M_G[copy_count]|S_G[copy_count];
     A_B = H_B[copy_count]|M_B[copy_count]|S_B[copy_count];
     strip.setPixelColor(copy_count,A_R,A_G,A_B);

So, although the strip isn't shown, the old data is wiped. Or so I thought.
Still plodding away and learning - slowly.

I've modified my code to this:

I don't think you'd be nearly so lost and confused if you used the space key more often.

     A_R = H_R[copy_count] | M_R[copy_count] | S_R[copy_count];

is much easier to read than

     A_R = H_R[copy_count]|M_R[copy_count]|S_R[copy_count];

Granted.

But would it fix the problem I mentioned?

But would it fix the problem I mentioned?

No, but the snippets don't provide enough information, either.

The full sketches are at the top of the thread.

Though I included one twice by mistake.

I am trying to work it out myself, but am running into "invisible" road blocks, like array size problems.
I have got rid of that problem by removing one of the arrays. Now I have to work out how to put the "numbers" on the face of the clock.

But that aside, I am confused why when I OR the three arrays together sometimes it does, and sometimes it doesn't blend the colours.

Also when the minute ticks over and moves to the next LED, sometimes it "leaves behind" an LED turned on. Sometimes not.

I thought that writing the entire strip to 0x000000 before I do the OR functions it may remove some of the problems.

Though it doesn't seem to be doing that.

I put the wipe part in the same loop as the OR and still the same.

So I am missing something. (An elephant - I believe is the term used.)

It is not easy for me to explain what is going on as a lot of it is you have to see it rather than me trying to explain it.
Granted that is MY problem. But as I said: I am trying.