TIP: Simple function to help with difficult debugging


You are on the correct track. Similar to what I do. I normally define one of the port pins as a test pin, usually 7 for no reason then that is the first pin i used years ago. Then I turn it on and then off, and either look for the pulse or measure it. The external hardware triggers on this pulse. This works great for timing functions etc. I do this with either an inexpensive logic analyzer or a scope. With the logic analyzer I can monitor many pins but the delays introduced in the code because of this is minimal. The best thing I ever purchased for this Arduino stuff was an inexpensive logic analyzer, it was less then $10.00 on ebay.

Its a good tip adaptable to many implementations. I use a simple piezo sounder and generate beep codes like the PC BIOS does.