Last active
July 22, 2018 00:42
-
-
Save J3698/ab69434e4eb814a8f70d96cdeba57c2a to your computer and use it in GitHub Desktop.
Send and retrieve the Bluetooth module's settings
This file contains hidden or 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
void setup() { | |
// Start the serial monitor | |
/* | |
Note: make sure the serial monitor's | |
baud rate is set to 115,200 | |
*/ | |
Serial.begin(115200); | |
// Start communication with the Bluetooth module | |
Serial1.begin(115200); | |
delay(100); | |
} | |
void loop() { | |
// Get user input | |
String toBluetooth = ""; | |
while (Serial.available()) { | |
toBluetooth += (char) Serial.read(); | |
} | |
// Send user input to the Bluetooth module | |
Serial1.print(toBluetooth); | |
// Get Bluetooth module output | |
String toPc = ""; | |
while (Serial1.available()) { | |
toPc += (char) Serial1.read(); | |
} | |
// Send Bluetooth module output to serial monitor | |
Serial.print(toPc); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment