How to Debug a digitalWrite

Hi, I'm developing a program which the idea is to guess and print a number, chosen by the user, between 0, 127. The way that the program has to guess it is by displaying a 7 sequences of numbers. The first one is of all numbers who have their first bit as 1. And then for the one's who have their 2nd bit as 1, and so on until the 7th bit. For now I was able to make it run smoothly but when the last option, which is YES for having the last bit as 1, has an overflow and ends up lighting all leds.

Add a debug Serial print to confirm all the pin calculations are valid.

Always add good comments to the lines of code.

I suppose you want to reset m a this point (last one in the loop) so

m = -1;


Meanwhile I was able to fix the program but thanks!

Yes in order for it to restart, but I was incrementing just for tests

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.