You can leave the
pinMode
call in the
setup
function because you only need to call it
once. The project would still work if you moved it into the loop, but there is no need and it
is a good programming habit to do things only once if you only need to do them once. So
modify your sketch so that it looks like this:
Run this sketch and see what happens. It may not be quite what you were expecting.
The LED is basically on all the time. Hmm, why should this be?
Try stepping through the sketch a line at a time in your head:
1. Run
Dostları ilə paylaş: