1#include <SoftwareSerial.h>
2SoftwareSerial HM10(8, 9);
3char appData;
4String inData = "";
5void setup()
6{
7 Serial.begin(9600);
8 Serial.println("HM10 serial started at 9600");
9 HM10.begin(9600);
10 pinMode(13, OUTPUT);
11 digitalWrite(13, LOW);
12
13}
14
15void loop()
16{
17 HM10.listen();
18 while (HM10.available() > 0) {
19 appData = HM10.read();
20 inData = String(appData);
21 Serial.write(appData);
22 }
23
24
25 if (Serial.available()) {
26 delay(10);
27 HM10.write(Serial.read());
28 }
29 if ( inData == "F") {
30 Serial.println("LED OFF");
31 digitalWrite(13, LOW);
32 delay(500);
33 }
34 if ( inData == "N") {
35 Serial.println("LED ON");
36 digitalWrite(13, HIGH);
37 delay(500);
38 digitalWrite(13, LOW);
39 delay(500);
40 }
41}