2019-12-27 18:40发布
amazing030 发表于 2015-5-29 15:03 code u8 alarm_tab[200] = { 210,210,210,210,210,210,219,219,219,219,
fakeCode 发表于 2015-5-29 13:39 用两个IO口来控制,一个是PWM波,另外蜂鸣器要用无源的。音效你需要自己分析发音过程实现。 ...
最多设置5个标签!
{
210,210,210,210,210,210,219,219,219,219,
219,218,218,218,217,217,217,216,216,215,
215,215,214,214,213,213,212,211,211,210,
210,209,208,208,207,206,206,205,204,204,
203,202,201,201,200,199,198,198,197,196,
195,195,194,193,192,192,191,190,190,189,
188,187,187,186,185,185,184,183,183,182,
181,181,180,180,179,179,178,178,177,177,
176,176,176,175,175,174,174,174,174,173,
173,173,173,173,172,172,172,172,172,172,
172,172,172,172,172,172,173,173,173,173,
173,174,174,174,174,175,175,175,176,176,
177,177,178,178,179,179,180,180,181,181,
182,183,183,184,185,185,186,187,187,188,
189,189,190,191,192,192,193,194,195,195,
196,197,198,198,199,200,201,201,202,203,
204,204,205,206,206,207,208,208,209,210,
210,211,211,212,212,213,214,214,215,215,
215,216,216,217,217,217,218,218,218,219,
219,219,219,219,210,210,210,210,210,210
};
for (i = 0 ; i < 800; i++)
{
Delay_us(alarm_tab[i/4] - 18);
BEEP = !BEEP;
}
我用这个做警报声,也调了些时间,感觉效果还可以,延时自己调下改变音调
说一个看到的其他产品的,就是类似LZ要求的简单声音的:
首先录音,得到声音数据,这个数据要是通过DAC播放是OK的。采样率根据你单片机性能了,,
使用同样采样率配置然后通过PWM播放,PWM引脚输出经过一串阻容调理电路,(硬件水平烂,只能到这里了)
进入功放IC即可播放。
------编辑原因:补充
那个产品,从PWM播放出来的,效果比较好的了,嘟嘟,咚咚,滴答的声音都可以
这个声音做出来比较单调
能否具体点呢
一周热门 更多>