Connection Bluetooth with ATSAMD21

hello, i need help to connect this board with the bluetooth module HC-05. This is the code I'm using. I can only compile if I use SerialUSB. Any tips on how to resolve it? I've tried using the ArduinoBLE library, but without success.

#include <AudioFrequencyMeter.h>
#include <SerialCommand.h>

AudioFrequencyMeter meter;

void setup() {

  SerialUSB.begin(115200);
  SerialUSB.println("started");
  
  //Bluetooth
  Serial1.begin(115200);

  meter.setBandwidth(50, 200);    // Ignore frequency out of this range
  meter.begin(A1, 5000);             // Initialize A0 at sample rate of 45 kHz
}

void loop() {
  
  float frequency = meter.getFrequency();
  if (frequency > 0)
  {
    SerialUSB.print(frequency); SerialUSB.println(" Hz");
    Serial1.print(frequency); Serial1.println(" ");
    Serial1.write(frequency); SerialUSB.write(" Hz");
    //SerialUSB.println("-");
  }
  delay(100);
}

does HC-05 use 115200 baud?

yes

@gleonn, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

@gleonn, why did you move your topic back to Installation and Troubleshooting?

At the moment that you can upload a sketch, it has nothing to do with Installation and Troubleshooting !! If you don't agree on the category that I picked, move it somewhere else. But please move it out of Installation and Troubleshooting, else somebody will do it.

On Arduino M0 SerialUSB is the right name for Serial over USB.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.