Jakdrinnan

I am quite new to Arduino programming, but have a live project that needs to be installed next week with a completely working system. Fortunately I dont think what i need to do is terribly complicated, just slightly beyond my reach at the moment.

Basically I will be using and Arduino Mega to control a relay board connected to 10 different LED strips. I have a megnetic hall effect sensor which is connected to one of the Megas digital pins. Every other time the sensor is triggered, I need one of the LED strips to turn off. I also need a timer to start after the first trigger for 30 seconds, after which all the lights that are currently will turn back on and the system can start again.

I hope i have made a clear explanation of what I am looking for. I do have a working model that I made through the Grasshopper plugin Firefly, but the code wont compile properly and doesnt work on the board.

Using the Arduino IDE I can turn off all the lights in order each after a certain amount of state changes, but my major problem that i cant seem to find a solution for the timer and reset 30 seconds after the first state change.

Any help pointing me in the right direction would be much a appreciated, and anyone willing to help out with some code will be reimbursed for their time accordingly.

As I say, I need this to be up and running asap for an installation next week. Need a working model hopefully by Tuesday.

I suggest you use millis() to watch the elapsed time.Capture the millis() when you do the first transition, and every pass thru loop captures it again until the time has passed that you reset/restart.I often set a flag to indicate that an action is in progress, and use that and a time comparison to make a decision: