You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Connect the Hc-06 module and communicate using the serial monitor
168
+
//
169
+
// The HC-06 defaults to AT mode when first powered on.
170
+
// The default baud rate is 9600
171
+
// The Hc-06 requires all AT commands to be in uppercase. NL+CR should not be added to the command string
172
+
// Use no line ending in serial monitor
173
+
/*Command Reply Comment
174
+
The HC-06 zs-040 expects commands to be in upper case and does not require carriage return and new line (\r\n) characters.
175
+
Open the serial monitor and select a baud rate of 9600 and ensure “No line ending” is selected from the drop down list at the bottom of the window.
176
+
Enter “AT” (no quotes) into the top text box and hit Send. If the HC-06 likes you it will say OK. AT is a basic communications test command that allows you to check the HC-06 is connected and communicating.
177
+
178
+
AT OK Communications test
179
+
AT+VERSION OKlinvorV1.8 Firmware version.
180
+
AT+NAMEPanda OKsetname Sets the modules name to “Panda”
181
+
AT+PIN1234 OKsetPIN Set the PIN to 1234
182
+
*/
183
+
184
+
#include <SoftwareSerial.h>
185
+
SoftwareSerial BTserial(2, 3); // BT_TX | BT_RX
186
+
// Connect the HC-06 TX to the Arduino RX on pin 2.
187
+
// Connect the HC-06 RX to the Arduino TX on pin 3.
188
+
189
+
190
+
void setup()
191
+
{
192
+
Serial.begin(9600);
193
+
Serial.println("Enter AT commands:");
194
+
195
+
// HC-06 default serial speed is 9600
196
+
BTserial.begin(9600);
197
+
}
198
+
199
+
void loop()
200
+
{
201
+
202
+
// Keep reading from HC-06 and send to Arduino Serial Monitor
203
+
if (BTserial.available())
204
+
{
205
+
Serial.write(BTserial.read());
206
+
}
207
+
208
+
// Keep reading from Arduino Serial Monitor and send to HC-06
0 commit comments