# Electronic target system \> Seeking advice on technical choices !

**URL:** <https://forum.arduino.cc/t/electronic-target-system-seeking-advice-on-technical-choices/1386289>\
**Category:** General Guidance\
**Created:** [June 2, 2025, 7:11pm UTC](https://forum.arduino.cc/t/electronic-target-system-seeking-advice-on-technical-choices/1386289 "2025-06-02T19:11:05Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![alto777](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/alto777/32/317385_2.png) [@alto777](https://forum.arduino.cc/u/alto777)\
**Post date:** [June 10, 2025, 1:41pm UTC](https://forum.arduino.cc/t/electronic-target-system-seeking-advice-on-technical-choices/1386289/25 "2025-06-10T13:41:35Z")

</div>

> [@albertbonduelll](#):
>
> was this what you were thinking about ?

Good work!

But when I take your link, I get the simple sketch. IDK if that's because of I don't know why.

Anyway, I can read the code and see what it does, probably.

There are a few stray harmless semicolons finding themselves after a closing brace };.

Watch out for those, don't use semicolons when they are not needed though harmless. Sometimes stray semicolons can cause problems (bugs), and having them makes a reader wonder. You can harmlessly strew semicolons, they are just noise. A distraction.

Next, and just an observation, this does spam the serial monitor. There are a number of good ways to cut that down, I'll save that for later.

The LED will be on as long as you are holding the button down, and then for ~~three~~ two (!) more seconds, unless you get your finger back on the button.

The desired behaviour is that the act of pushing the button down initiates a N second LED burst. So even if you have the button held, the LED goes off. If during the LED on phase you release and press again the button, it will be N seconds from the moment you again pressed the button until the LED goes off.

This is a tiny example of how one must think through and completely work out all the things that can happen, and what the specific functionality is to be.

The basic concept that will help you is called "state change detection" (or "edge detection") which concerns itself with the fact that a button becomes pressed rather than that it is being held pressed. The other edge is the release of the button, when we could say it becomes unpressed, if we said anything at all about that event.

There's a crap-ton of state change detection tutorials. Google is your friend. Read this post and the thread it finds itself on:

> [@Making a LED switch but it's a bit more complex](https://forum.arduino.cc/t/making-a-led-switch-but-its-a-bit-more-complex/1300283/17):
>
> I think the state change detection as typically presented is harder to understand, or at least it is easier once a few things get learnt. After the check for a change in the input, if there is one we can deduce that a pressed button must just have become pressed, and similarly an unpressed button must just have been released. But we use the state as proxy for those events. Properly, from a logic point of view, but confusing. Borrowing from some code I saw that handled multiple inputs and reca…

and this thread

> [@Storing Button State](https://forum.arduino.cc/t/storing-button-state/1185825):
>
> I have written a simple piece of code to turn a white LED on if the button is pressed. I would like the button state to be remembered so the LED doesn't turn off till the button is pressed again. For some reason, this doesn't work and I'm not sure where I've gone wrong: int whiteledPin = 8; int buttonPin = 4; int lastState = digitalRead(4); void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT\_PULLUP); pinMode(whiteledPin, OUTPUT); } void loop() { int currState = digitalRead(bu…

for a good start.

Thanks for your implicit trust that these small exercises will pay off in the long run.

a7

---

_[View the full topic](https://forum.arduino.cc/t/electronic-target-system-seeking-advice-on-technical-choices/1386289)._
