Been fighting with a HM-10 module for some time and as i test i tried SoftSerial_INT0 (
https://github.com/J-Rios/Digispark_SoftSerial-INT0) with DigiKeyboard to see the data being passed.
when I print through the keyboard and the serial (show in the code below). it works fine (see image sc01)
#include "DigiKeyboard.h"
#include <SoftSerial_INT0.h>
SoftSerial mSerial(2, 1); // Rx, Tx
void setup() {
mSerial.begin(9600);
void loop() {
static char cmd;
if(mSerial.available())
{
cmd = mSerial.read();
DigiKeyboard.print(cmd);
mSerial.write(cmd);
if (cmd == '\n') {
DigiKeyboard.println("OK");
mSerial.write("OK\n");
}
}
DigiKeyboard.update();
}however if I just write through the serial by commenting out the keyboard.print lines, the characters get skewed (see image sc02)
// DigiKeyboard.print(cmd);
mSerial.write(cmd);
if (cmd == '\n') {
// DigiKeyboard.println("OK");
mSerial.write("OK\n");Can anyone explain to me why this happens and how I can get SoftSerial to work with DigiKeyboard?
Also, note I was getting the same issue when using the original SoftSerial and TinyPinChange.
Other Details:
android App: Serial Bluetooth Terminal
by Kai MorichWiring: see image wiring.jpg