3678| 1
|
[求助] 程序的顺序好像有问题 |
程序写完后,蜂鸣器一直响, float sinVal; int toneVal; void setup() { pinMode(8,INPUT); Serial.begin(9600); } void loop() { int sensorValue=analogRead(0); Serial.print(sensorValue); delay(1); if(sensorValue>1023){ for(int x=0;x<180;x++){ sinVal=(sin(x*(3.1412/180))); toneVal=2000+(int(sinVal*1000)); tone(8,toneVal); delay(2); } }else{noTone(8); } } |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed