PDA

View Full Version : Code question - BSManual-v2.2, FREQOUT.bs2, Page 201.



MichelB
12-04-2009, 12:48 AM
What is the "benefit" to change the output pin (Spkr· PIN· 0) in an input pin just before END?

Mike Green
12-04-2009, 01:00 AM
When the Stamp executes an END, it goes into a low power mode like the one that's used for NAP and SLEEP where it wakes up periodically, then goes back into low power mode. Like NAP and SLEEP, any I/O pins set to output mode will become inputs for a short time. If you have a speaker attached to an I/O pin and leave it set to output mode, you'll get a clicking during the END as the Stamp wakes up and goes back to sleep switching the I/O pin from output to input and back again periodically. Setting the I/O pin to input mode avoids this.

MichelB
12-04-2009, 05:14 PM
Thank you very much for explanation.