So I am relatively new to the Arduino world and just recently started my first project and would like to see if anyone could point me in the right direction.
I am building a timer for some airsoft scenario games I play and I have semi successfully implemented a program that does almost everything I want it to do.
Since I do not have the skill yet to write code from the base up I have taken various code segments from other websites and put them together.
Here is the skinny of it.
- Program starts by asking for a 4 digit code
- Enter code and preset timer starts
- Hit * and enter the same code to defuse.
4 If the timer goes off or too many wrong code attempts happen, an alarm sounds. - Unit resets.
That's the skinny.
So after I was able to do the above, I wanted to add another way for the timer to alarm or be disabled. Just as seen in almost any corny action flick, I wanted wires you could cut to disarm (or set off) the timer.
After searching around I found that nootropic design makes a alarm clock that has that exact function I want in my timer. (Defusable Clock)
I tried to implement the code segment that randomizes the pins for the defuse wire and alarm wire and the other part of the code that sets off (or defuses) the timer.
I have been only semi successful.
I was able to make one wire set off the alarm (when cut) but it will not randomize which pin it is.
I have been unsuccessful in placing the disarm code in the correct part of the program and I have tried it quite a few places with nothing good to report. It will either not work (no wire turns off the timer) or it will cause the timer to just not work.
I was wondering if anyone had any help or advise on my issue. I apologize in advance for all the bad code but here is what I have.
This is being ran on a SainSmart Mega 2560. I'm also using the SainSmart LCD Keypad Shield.
Any help on how to make the defuse wire work and/or be able to randomize the defuse and trigger wires would be great.
Ultimately I want to figure out how to be able to set the time instead of having it hard-set into the program and also how to make 1 wire trigger the alarm, 1 wire to defuse the alarm and 2 wires to cut time off the timer.
Thanks in advance for the help!
Edit:
I didn't think to upload the code as a file. I do apologize for the posts
rush23.ino (9.23 KB)