This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SoftwarreSerial and bluefruit conflict

Hi, 

I'm using nrf52840 and a barcode reader by UART using softwareSerial.h library, it works fine. I am also using the bluefruit.h library to communicate by bluetooth that also works fine, but when using them together there is a problem with communication with the barcode reader.

When I don't initialize the bluetooth the reader gives me the message correctly, for example "005014", but with "Bluefruit.begin ();" the reader gives me messages like "0?p5014"

I tried changing the ports but the problem persists.

#include <SoftwareSerial.h>
#include <bluefruit.h>
String dato;
SoftwareSerial puertoLectora(19,20); //(Tx,Rx)
{
Serial.begin(115200);
puertoLectora.begin(115200);
Bluefruit.begin();  //<--PROBLEM
}
void loop()
{
if (puertoLectora.available() > 0)
{
dato = "";
while (puertoLectora.available())
{
dato += char(puertoLectora.read());
}
Serial.println(dato);
}
}

Related