[C] 纯文本查看 复制代码
void Broadcast(uint8_t band) {
digitalWrite(rst, HIGH);
delayMicroseconds(200);
digitalWrite(rst, LOW);
delayMicroseconds(200);
int playBand = band;
while (band > 0) {
digitalWrite(data, HIGH);
delayMicroseconds(100);
digitalWrite(data, LOW);
delayMicroseconds(100);
band--;
}
delay(interval * VoiceNum[playBand - 1]);
}
[C] 纯文本查看 复制代码
//经过测试: 400ms*xx为最佳间隔时间
//例如: 0 + delay(400*1); 现在时刻北京时间 + delay(400*4.5); 具体值见数组:VoiceNum
#define interval 400
const float VoiceNum[32] = {
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1.5, 4.5, 1, 1.5, 1, 1.5,
2, 2, 2, 3, 2, 3, 4.5, 4.5
};