adsense

2012-03-21

自走車 蜂鳴器 Do Re Mi


' BuzzerKeyin.inb: Buzzer Control Using SOUND Command
Const Frequency(15) As Word = {523,587,659,698,785,880,988,1047,1046,1174,1318,1396,1570,1760,1976,2094}  'Array for Frequency
Sub main()
Dim key As Short 'Local Variable
Debug CLS,"Press 1 ~ 8 + q ~ u...", CR

Do
Keyin key
'小寫 'k=key-48
If (Key=113) Then Sound(12,250,Frequency(9))
If  (Key=119) Then Sound(12,250,Frequency(10))
If  (Key=101) Then Sound(12,250,Frequency(11))
If  (Key=114) Then Sound(12,250,Frequency(12))
If  (Key=116) Then Sound(12,250,Frequency(13))
If  (Key=121) Then Sound(12,250,Frequency(14))
If  (Key=117) Then Sound(12,250,Frequency(15))
'大寫
If (Key=81) Then Sound(12,250,Frequency(9))
If  (Key=87) Then Sound(12,250,Frequency(10))
If  (Key=69) Then Sound(12,250,Frequency(11))
If  (Key=82) Then Sound(12,250,Frequency(12))
If  (Key=84) Then Sound(12,250,Frequency(13))
If  (Key=89) Then Sound(12,250,Frequency(14))
If  (Key=85) Then Sound(12,250,Frequency(15))

key-=48
If (Key>0 And Key<9) Then Sound(12,250,Frequency(Key-1))




Loop
End Sub

沒有留言:

張貼留言