I have two separate nanos configured for this, and have tried 4 (possibly 5) BT devices of this class, with one brand new out of its sealed packet.
The circuit is straightforward: pins 8 & 9 for altSoftSerial to the tx & rx pins of the BT, A0 to a 2N7000 connecting ground to the ground pin of the BT, and A1 to read the status pin. (The ground pin is to kill power, as there appears to be no other way to shut down a connection once established, as most or all of these ignore their Enable pin. Without the mosfet, even though consumption should never hit 20ma, some shut off more often. Power comes from an iMac over the usb connector) ). There is a button and an LED for "proof of life", but they don't come into play here, and the results are the same with them removed.
Before a connections made, I can chat with the device over altSoftSerial; the initial portion of the transcript below is just that, as the program relays the hardware serial to the device. "Connected" is also received from the device when I attach by an iOS BLE program. (I've used multiple programs, with identical results).
Once I connect, it clearly receives commands, whether the 'y' or 'b' commends in doBtInBfr() to briefly turn on an LED, or the command to kill the connection 'k'.
All of the commands successfully write their status data to the hardware serial.
In all cases, however, the btSerial.print() commands fail to send data from the bt to the connected device fail to send any data.
This used to work, and for multiple nanos and bt devices.
This is for my sprinkler controller, but the attached program is a stripped down version of the one that used to read a DHT-22 temperature sensor in my hothouse.
I'm simply baffled at this point, and assuming that I must be missing something basic, as it used to work, and now fails identically across multiple hardware substitutes.
It also seems that the status pin from the bt device is occasionally going low while connected, even thou the connection continues.
The program makes the post too long, so is an attachment.
The world's worst schematic is attached. (Is "painful to use" a design goal for Eagle??? I failed to find either a device with the right pins or a way to add something that didn't want three separate tutorials!)
and the log:
leaving setup!
OK +NAME==hothouse_01 Connected ygot a y lightng #40 s abcyou said : abc [but nothing appears back on the iPad]
no_talkback.190510a.ino (9.74 KB)