A programming challenge involving piezo sensors, LEDs, and relays


seems to work great!

1 Like

I can see from the video that the test mode works which is great news. Looked like the target sensors were working as well but I could not see the values on the LCD clearly. I think the room is either too dark, or the LCD is too bright and the camera canā€™t adjust for both.

Does that mean that the whole thing is working now? Looked to me like it was showing player 1 and player 2 times at the end, but that might just be because you didnā€™t press the button to reset them after the test mode?

Please let me know whatā€™s still not working and Iā€™ll have a look at the code again. Iā€™m over at friends tonight and might not be back until tomorrow. Sorry, Iā€™ll get on it as soon as Iā€™m free again.

1 Like

Once this is working, or maybe just as my next update, Iā€™d like to refactor the code. That means changing how itā€™s written without changing how it behaves. The two functions are far too long and that makes them difficult to read and understand. My hope all along has been that sharing the code will be clear enough that youā€™re interested to learn more, or the next person to visit this thread will look at the history of the code file and see how things can be written.

1 Like

Okay so the thing appears to work really well! it still on rare occasion wont reset but other than that the test mode works well and it appears to all be sensing well. also as far as it working after the test mode it also adds the time it took to cycle through the test mode to the reaction time but this only happens after you enter test mode. If you donā€™t enter test mode then it works just fine.

Still, a bug I can easily fix so Iā€™ll do that after work this evening.

1 Like

Let me take those opportunity to say how rewarding itā€™s been for me to help you on this project. Your feedback has been encouraging and detailed. :+1:

1 Like

hey i totally couldnā€™t have done it without you and Iā€™m thrilled that you are as excited as i to do it! without a doubt I will continue increasing my understanding of python and the arduino language!

1 Like

so what changes have you made?

Iā€™m sorry, Iā€™ve been snowed under at work. Had to work 6 days last week and will be doing the same this week again. :slightly_frowning_face:

I might have some time tonight to review and update the code.

1 Like

Rightā€¦ I canā€™t see why the target times would include the test time from the diagnostics run. Might be just me being dead on my feet.

Iā€™ve refactored the code into methods to make it easier to comprehend. In theory nothing should have changed with regards functionality/operation. Youā€™ll notice that the Setup and Loop methods are now a lot shorter and easier to understand:

1 Like

Where do we go from here @Drewkus? Do you want me to make further code changes, or are you happy with it as it is now?

Iā€™m hoping youā€™ll post a video of the final build in use! :smiley:

1 Like

Yes! finally got back from a long unexpected family trip. Ill give it a go as soon as i return home today and will progress to getting the final product ready for everybody to see!

1 Like

I hope all is going well with your project. It could make an interesting video of all the trial and error leading up to the final product. :wink: :smiley:

1 Like

What happened too this project @Drewkus? Iā€™m hoping you and your body have had so much fun playing with it youā€™ve forgotten to post a follow up? :smile: