You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 年之前
9 年之前
9 年之前
9 年之前
9 年之前
9 年之前
9 年之前
123456789101112131415161718192021222324
  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. }