|
if(temperature>25)
{
int thisNote = 0;
while( thisNote < 8)
{
tone(8, melody[thisNote], duration);//第一个是输出引脚,第二个是要发的声调,第三个是持续时间的意思
delay(duration);
thisNote++; //
}
if (thisNote==8)
thisNote=0; //清零
digitalWrite(RED, HIGH);
digitalWrite(BLUE, LOW);
digitalWrite(GREEN, LOW);
}
|
|