#include #define LED_PIN 2 SoftwareSerial BTserial(10, 11); // RX, TX // Connect HM10 Arduino Uno // Pin 1/TXD Pin 10 // Pin 2/RXD Pin 11 char c=' '; boolean NL = true; void setup() { Serial.begin(9600); Serial.print("Sketch: "); Serial.println(__FILE__); Serial.print("Uploaded: "); Serial.println(__DATE__); Serial.println(" "); BTserial.begin(9600); Serial.println("BTserial started at 9600"); } void loop() { // Read from the Bluetooth module and send to the Arduino Serial Monitor if (BTserial.available()) { c = BTserial.read(); Serial.write(c); } // Read from the Serial Monitor and send to the Bluetooth module if (Serial.available()) { c = Serial.read(); // do not send line end characters to the HM-10 if (c!=10 & c!=13 ) { BTserial.write(c); } // Echo the user input to the main window. // If there is a new line print the ">" character. if (NL) { Serial.print("\r\n>"); NL = false; } Serial.write(c); if (c==10) { NL = true; } } }