• Hi,

    Your issue in this case is you're trying to use software serial - it's a reasonably new addition and it struggles on Bluetooth boards with this kind of thing because the second data is received it prints it to Bluetooth, which uses up a bunch of CPU time which then interferes with reception/transmission.

    If you actually use the first example on that page which is for hardware serial, you get:

    Serial1.setup(9600, {rx:D25, tx:D26});
    Serial1.on('data', function (data) { print("<Serial> "+data); });
    Serial1.print("Hello World");
    

    I just tried this on an MDBT42, and I get:

    <Serial> H
    <Serial> e
    <Serial> l
    <Serial> l
    <Serial> o
    <Serial>
    <Serial> W
    <Serial> o
    <Serial> r
    <Serial> r
    <Serial> l
    <Serial> d
    

    so it works great.

    So basically all you need to do is replace:

    var s=new Serial();
    s.setup(9600, {rx:D25, tx:D26});
    

    with:

    var s=Serial1;
    s.setup(9600, {rx:D25, tx:D26});
    
About

Avatar for Gordon @Gordon started