That code works just fine, unaltered ..... https://www.dropbox.com/s/sahdbkj2gyin7 … 7.mov?dl=0
How are you connecting the HM-10 to the arduino pins 2 & 3 ?
The HM-10 uses 3.3V level signals, the Arduino uses 5V. You can safely connect the HM-10 Tx pin directly to the Nano's Rx pin 2, but the Nano's Tx pin 3 should go via a logic level converter (or a voltage divider : Nano_TX : 1K : HM-10_RX : 2K : GND) to the HM-10 Rx pin
Check your HM-10 configuration using this sketch....
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2, 3); // Rx, Tx
void setup() {
Serial.begin(9600);
BTSerial.begin(9600);
while(!Serial);
Serial.println("AT Commands: okay ");
}
void loop() {
// read from the HM-10 and print to Serial
if(BTSerial.available())
Serial.write(BTSerial.read());
//read from serial and write to the HM-10
if(Serial.available())
BTSerial.write(Serial.read());
}
Using the serial monitor screen, set to "Both NL & CR", and "9600 baud"
You should see "AT Commands: okay"
If you don't, try different baud rates on the serial monitor until you do. It might be that the HM-10 has been configured at a different baud rate.
If you find a baud rate that works, you can either modify the "Interface" section of your RemoteXY app to match, or reset it to 9600 with the AT command "AT+BAUD4", It should respond with "+BAUD=9600", then "OK" on next line.
2B, or not 2B, that is the pencil ...