2016年9月18日 星期日

程式集訓 F010:溢出字元-beep

#coding=utf8

#程式集訓  F010:溢出字元-beep
'''
題目:(F010) 溢出字元-beep : 輸出相同的字串及聲音

Escape Sequence Meaning
\newline Ignored
\\ Backslash (\)
\' Single quote (')
\" Double quote (")
\a ASCII Bell (BEL)
\b ASCII Backspace (BS)
\f ASCII Formfeed (FF)
\n ASCII Linefeed (LF)
\r ASCII Carriage Return (CR)
\t ASCII Horizontal Tab (TAB)
\v ASCII Vertical Tab (VT)
\ooo ASCII character with octal value ooo
'''
#\xhh.... ASCII character with hex value hh....

#If you're on a Unix terminal, you can print "\a" to get a terminal bell:
def beep():
      print ("\a")

for i in range (0,10):
    beep()
#=======================================
import winsound         # for sound
import time             # for sleep

Freq = 2500 # Set Frequency To 2500 Hertz
Dur = 1000 # Set Duration To 1000 ms == 1 second
winsound.Beep(Freq,Dur)
time.sleep(0.25)        # in seconds (0.25 is 250ms)

winsound.Beep(440, 250) # frequency, duration
time.sleep(0.25)        # in seconds (0.25 is 250ms)

winsound.Beep(600, 250)
time.sleep(0.25)

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...