' {$STAMP BS2} ' {$PBASIC 2.5} ' 2008 mlab.taik.fi/paja ' Experiencing a Piezo Speaker ' ---[ I/O Definitions ]--- pPiezo PIN 9 DO ' FREQOUT Pin, Duration, Freq1{, Freq2} ' Pin: Pin number (0-15) ' Duration: Specifying the amount of time to generate the tone. (0-65535) ' BS2: a unit = 0.4ms ' Freq1: Specifying frequency of the first tone. (0-32767) ' BS2: a unit 1Hz ' Freq2: When specified, two frequencies will be mixed together FREQOUT pPiezo, 500, 1308 FREQOUT pPiezo, 500, 1468 FREQOUT pPiezo, 500, 1648 FREQOUT pPiezo, 500, 1746 FREQOUT pPiezo, 500, 1950 FREQOUT pPiezo, 500, 2200 FREQOUT pPiezo, 500, 2469 FREQOUT pPiezo, 500, 2616 PAUSE 500 LOOP