您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

25 行
778B

  1. void handleCmds( String cmd ) {
  2. String p = cmd;
  3. if (p.startsWith("f ")) {
  4. p.trim();
  5. p = p.substring(2);
  6. float t = p.toFloat();
  7. Serial.print("new frequency: ");
  8. Serial.println(t);
  9. AudioNoInterrupts(); // disable audio library momentarily
  10. sine.frequency(p.toFloat());
  11. AudioInterrupts(); // enable, both tones will start together
  12. }
  13. else if (p.startsWith("a ")) {
  14. p.trim();
  15. p = p.substring(2);
  16. float t = p.toFloat();
  17. Serial.print("new amplitude: ");
  18. Serial.println(t);
  19. AudioNoInterrupts(); // disable audio library momentarily
  20. sine.amplitude(p.toFloat());
  21. AudioInterrupts(); // enable, both tones will start together
  22. }
  23. }