PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

47 行
1.1KB

  1. /* Mono Peak Meter
  2. Scrolling peak audio level meter in the Arduino Serial Monitor
  3. Audio input needs to connect to pin 16 (A2). The signal range is 0 to 1.2V.
  4. See the documentation in the Audio System Design Tool for the recommended
  5. circuit to connect an analog signal.
  6. This example code is in the public domain
  7. */
  8. #include <Audio.h>
  9. #include <Wire.h>
  10. #include <SPI.h>
  11. #include <SD.h>
  12. #include <SerialFlash.h>
  13. // GUItool: begin automatically generated code
  14. AudioInputAnalog adc1; //xy=164,95
  15. AudioAnalyzePeak peak1; //xy=317,123
  16. AudioConnection patchCord1(adc1, peak1);
  17. // GUItool: end automatically generated code
  18. void setup() {
  19. AudioMemory(4);
  20. Serial.begin(9600);
  21. }
  22. // for best effect make your terminal/monitor a minimum of 31 chars wide and as high as you can.
  23. elapsedMillis fps;
  24. void loop() {
  25. if (fps > 24) {
  26. if (peak1.available()) {
  27. fps = 0;
  28. int monoPeak = peak1.read() * 30.0;
  29. Serial.print("|");
  30. for (int cnt=0; cnt<monoPeak; cnt++) {
  31. Serial.print(">");
  32. }
  33. Serial.println();
  34. }
  35. }
  36. }