Shop OBEX P1 Docs P2 Docs Learn Events
Code question - BSManual-v2.2, FREQOUT.bs2, Page 201. — Parallax Forums

Code question - BSManual-v2.2, FREQOUT.bs2, Page 201.

MichelBMichelB Posts: 154
edited 2009-12-04 09:14 in BASIC Stamp
What is the "benefit" to change the output pin (Spkr· PIN· 0) in an input pin just before END?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-03 17:00
    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.
  • MichelBMichelB Posts: 154
    edited 2009-12-04 09:14
    Thank you very much for explanation.
Sign In or Register to comment.