Last active
November 20, 2018 09:44
-
-
Save kingardor/305291ab0e12f4b1a72e5e0bab90ba7c to your computer and use it in GitHub Desktop.
Code to use HM-10 with Arduino/ESP8266
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Method to enter AT | |
* Connections: | |
* Arduino/Esp8266 HM10 | |
* GND GND | |
* 5V 5V | |
* RX RX | |
* TX TX | |
* Open Serial Monitor. Set the Baud to 9600 with NL&CR. Test for AT. | |
*/ | |
#include <SoftwareSerial.h> | |
//For Arduino | |
//SoftwareSerial mySerial(8,9); // RX, TX | |
//For ESP | |
SoftwareSerial mySerial(12,13); // RX, TX | |
void setup() { | |
Serial.begin(9600); | |
mySerial.begin(9600); | |
} | |
void loop() { | |
char c; | |
if (mySerial.available()) { | |
c = mySerial.read(); | |
Serial.println("Got input:"); | |
Serial.println(c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment