Who wants money to write me some code?

Subject closed and completed.

Aehm, could you be a bit more specific in what you actually want?

Just show the two sketches here, the one with the laser and the one with knocking.
Make sure to click the </> button (code tags) when you copy sketches in a message here.
Sounds simple enough so even lazy communists might help you.

zwieblum - he wants a sketch that turns the laser on for 30ms whenever you knock the knocking sensor.

PM sent.

@blimpyway: Not sure if that's what he wants, 'cause that's already in the code. What makes me curiouse is the "settings" in

End result of what I want is for that KY-031 code (with it's settings) to then set the laser off for a duration of millisends that I can then decide at a later date.

What settings?

blimpyway:
zwieblum - he wants a sketch that turns the laser on for 30ms whenever you knock the knocking sensor.

Exactly that.

Ok I needed the two just to save time with asking what pin numbers you used.

Assuming the knocking test sketch prints "KNOCK KNOCK" when bullet hits the target, all it needs is adding the laser flashing code, which is a 30ms delay() between two digitalWrite()

first to turn laser on, second to turn it off.

Hope it works, I didn't spent time to test it, at least it compiles without errors.

laserknock.ino (1.28 KB)

Everything all sorted. I am now a happy bunny once again.