📄 music.c
字号:
#include<reg51.h>
#include<define.h>
#include<global.h>
#include<initial.h>
#include<delay.h>
#include<led.h>
#include<input.h>
#include<beep.h>
#include<key.h>
#include<music.h>
byte code SOUNDLONG[ ] =
{
12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12
};
byte code SOUNDTONE[] =
{
3,188,3,83,2,246,2,204,2,125,2,56,1,250,
1,221,1,169,1,123,1,101,1,28,0,253,0,258
};
void Music(byte count)
{
byte i,k,j,SoundLong;
word m,SoundTone;
for(k=0;k<count;k++)
{
for(i=0;i<15;i++)
{
SoundLong = SOUNDLONG[i];
SoundTone = SOUNDTONE[i*2]<<2;
SoundTone+=SOUNDTONE[i*2+1];
for(j=0;j<SoundLong;j++)
{
for(m=0;m<SoundTone;m++)
P1_6=0;
for(m=0;m<SoundTone;m++)
P1_6=1;
}
DelayX10ms(50);
}
DelayX10ms(300);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -