Neopixel word clock HELP

Hi all,

I am writing code for a clock that tells the time in words and is built out of Neopixels. The clock will be similar to the clock.png to I uploaded - to get a sense of the project.


I’m running it off an Arduino Uno and have inputs from the following sensors:

1x LDR
1x RTC (DS3231)

I have written the code and its complete, however this is my first project and I am a little unsure why my code is not working. I have done a heap of googling and even tried to hire a freelancer to help me however they weren’t able to help.

When I upload the sketch to the arudino, 5% of the time the clock will work as expected, the LED’s which correspond to a particular letter I would like lit work, however after about 4 minutes, the time will just get stuck on a certain time (the last one was 13:48) and the LED’s will just stay stuck.

The other 95% of the time when I re upload the sketch, the LED’s won’t light at all. I’m getting a -wagressing-loop-optimisations error code when I do upload the sketch however the lights have been working with this error so that was going to be my second problem to attack - it seems like the lights are working despite this issue. I’ve uploaded a copy of the error message as an attachment also.

I’ve attached a .txt of my input connections to the arduino and my code as an attachment.

Any help at all would be appreciated. I have done no coding in my life and I can’t believe how much I have been able to modify myself, however I’m now stuck!



New_clock_LDR.ino (14 KB)

Connections.txt (414 Bytes)

Hi Robbie,

Please read the forum guide to find out what and how to post when you ask a question on the forum.

Please don't post screen shots of error messages or code like this. Copy all the error message text as text and post inside code tags. That way we can see all the messages and read them more easily. You should find a small "copy" link/button at the top right of the message window.

I can't open a .ino file on my phone, please post that between code tags also. If too big, attach as a .txt. Please perform an Auto-Format on your code before posting it.

How many NeoPixels in your clock? How many will ever be lit at once? How are you powering the clock?


Neopixels              Arduino PIN
 5V power     =         5V
 Data/DIN     =         3
 GND      =         GND

LDR                    Arduino PIN
 Out          =         13
 VCC          =         5V
 Gnd          =         GND

RTC (DS3231 AT24C32)   Arduino PIN
 SLC          =         A5
 SDA          =         A4
 VCC          =         5V
 Gnd          =         GND

Do you have a series resistor (~330R) on the data line to the NeoPixels and a large capacitor (470uF+) across the power lines going to the NeoPixels?

An LDR has two connections, not 3 and would be connected to an analog pin, accompanied by a fixed resistor to form a voltage divider. What exactly is your "LDR"? Please post a link, one that can be clicked. The forum guide tells you how.