Can I use Relays for the lights?
Oh, and no - you can't use relays for the lights. Relay coils are a heavy inductive load and draw a lot of current. I have had a lot of success using a 'darlington array' chip. They are five bucks or so.
sorry... I've rather pessimistic about this...Professional programmers generally charge around $100 USD an hour for consulting/contract work (about the same price as a plumber or auto mechanic). Most of us here are hobbyists so you can get plenty of free advice and help if you want to do it yourself, or maybe you can hire someone cheaper. But, a custom program is NEVER a 1-hour job! You can negotiate whatever you want, but usually these are by-the-hour contracts (not fixed-price), sometimes with a "not to exceed" stipulation. But, if the programmer agrees not to exceed 8 hours, that doesn't mean the program will meet your expectations in 8 hours... It means if you want additional work, he can't charge you without your approval.This might be a one day job if all the specs & requirements are nailed-down, but they usually aren't. There's usually some back-and-forth, tweaking & debugging and it might turn into 2 or 3 days.For a microcontroller project, the programmer usually needs his hands on the hardware (or a reasonable approximation/simulation of the final hardware).Anything for competition usually needs to be calibrated, verified, and certified so that no one questions the timing. A backup system might be required too. Nobody is going to trust a homemade timing mechanism. For "serious" competition, sometimes there is a sanctioning body, and they may need to approve any timing system.
Ok, man: here you go. Sketch attached.I have added "foul" detection, and I have added logic so that if the player's button is pressed during the "stopped" state, then it blips the timer start/stop pin. Maybe this isn't a good idea, but whatever.This seems to work ok for me with LEDs. The analog inputs are attached to resistors that are orange-orange-orange-gold, and then those resistors are plugged into 5v. The four input buttons ground the analog out. Seems to work ok. (Instead of buttons, I just touched a wire to the correct side of the resistor. Touch it to the wrong side and the Arduino goes bye-bye for a second or two.)Issues:* I can't test that the timer works correctly. I hope it does.* If one player fouls during the countdown, then the sketch is left in "countdown" state. This means that any press by the other player will also be counted as a foulIf you wanna send me money, we can do it via paypal. 2 hours. Normally I charge $100/hr AUD, but that's for Java at which I have years of experience. For C++ on an arduino - let's say a quarter of that and $50AUD for the two hours and not a word to the tax man.---(EDIT) Crap, I forgot to turn debugging off. Just comment out that line where DEBUG gets defined.(EDIT 2) Video at https://www.youtube.com/watch?v=wcDVXKPXJgQ
What's wrong with the picture?OP gets free software !
It's a hobby.A hobby.The Arduino platform (software, bootloader, IDE) is not a serious, industrial-grade platform and isn't meant to be. It's about hobby, learning, community. If the OP's problem was a days or weeks of work and required someone who understands the platform more thoroughly than my bit of fooling about with it, well that might be different. But it was a couple of hours on a Sunday while the machines (coincidentally, also powered by microprocessors) did my laundry for me.If the OP actually goes ahead and pays me, well: I was first in, lowest price. Yay for the free market! Isn't that the way it's meant to be?I hope people read my code and go "Holy shit! This is tres cool and a fine way to put together moderately complex behaviour!" I will not be charging them tuition.----(EDIT) Actually - come to think of it, my washing machine and dryer are powered by clockwork. But that's not the point.
Is this whole discussion ethical?