how can i improve my code?

HazardsMind:
You should look into interrupts. I don't think you need to debounce anything if it just sends out a pulse, but if you want efficiency then interrupts are the way to go.

unfortunately, i do need to debounce. the very first sketch i did didn't use debounce and the readings were always about 7X higher than they should of been.
will look into interrupts now, thanks! :slight_smile: