Go Down

Topic: Rainforest project (Read 497 times) previous topic - next topic



I'm just starting on my journey into the world of computing and electronics. It's going to take a wee while to get to grips with these subjects but I would be most grateful for some help with a rainforest project I would like to create.

I would like to create the following:

I have a sound recording of a rainforest that is approximately 50 mins long. Throughout the recording there periods (17) when a thunder storm starts and stops. I would like to control two sets of leds as follows:

1. Fade up (and stay on) 1 set (yellow) leds to simulate sunshine.
2. As the storm approaches fade down (and stay down) the yellow leds to simulate rain clouds coming in.
3. Create a lightning effect with the other set of leds.
4. When the storm passes fade up yellow leds (and stay up) until next storm comes through.

The sequence then repeats every time a storm comes through.

I'll be using an Arduino 'Uno', and I have found a lightning sketch which is ideal for the job.

I could do with help on how to fade up the leds and keep them on for several minutes between the rain storms. Initial thoughts were to use 'millis'?

Any help would be greatly appreciated but please be kind as this stuff if all 'Greek' to me at the moment.

Regards. Robbie


May 24, 2018, 12:11 am Last Edit: May 24, 2018, 12:12 am by PaulRB
Writing code using millis() can be more difficult for beginners. Writing code using delay() is usually considerably easier for beginners to grasp. But using delay() has a disadvantage. If that disadvantage is not a concern for your project, then you can follow the easier delay() method.

The disadvantage is that while delay() is running, the Arduino can do literally nothing else. It cannot even monitor a button to see if it gets pressed, for example. It cannot react to any external input.

So the question for you is will your code need to react in any way to an external input while the lighting sequence is running?


Hi Paul,

There are no external inputs it will just be a case of matching the light sequences to the audio. I know it's a whopper for a first project but I'll keep studying and looking at other people's projects for inspiration. I'm sure I'll get there in the end.


There are no external inputs it will just be a case of matching the light sequences to the audio.
So its all done entirely on timing. And you have no plans to introduce any external inputs? In that case, you can use delay() rather than millis() which will make your coding much easier, especially as you are a beginner.

Go Up