I was able to serial print only once out of the loop by using a flag, thanks for the help!
How do you recommend I go about applying the same function in the same program to another pair of switch/led and eventually extend it to n number of switch/led pairs.
larryd:
firsttime is a flag.
When it is set i.e. 1, you lock in the start time which subsequently is used in the calculations.Suggest you use a name like firstTimeFlag.
BTW
Use CTRL T to format the sketch.
Please use code tags.
Use the </> icon in the posting menu.[code] Paste sketch here. [/code]I am sure if you think about it a bit, you can figure out how to control printing the way you need.
.