Skip to content

Commit 258778c

Browse files
authored
Update README.md
1 parent f544cdb commit 258778c

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,51 +167,81 @@ BT TX - D2
167167
BT RX - D3
168168

169169
// Basic Bluetooth sketch HC-06_01
170+
171+
170172
// Connect the Hc-06 module and communicate using the serial monitor
171-
//
173+
172174
// The HC-06 defaults to AT mode when first powered on.
175+
173176
// The default baud rate is 9600
177+
174178
// The Hc-06 requires all AT commands to be in uppercase. NL+CR should not be added to the command string
179+
175180
// Use no line ending in serial monitor
181+
176182
/*Command Reply Comment
183+
177184
The HC-06 zs-040 expects commands to be in upper case and does not require carriage return and new line (\r\n) characters.
178185
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.
186+
179187
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.
180188

181189
AT OK Communications test
190+
182191
AT+VERSION OKlinvorV1.8 Firmware version.
192+
183193
AT+NAMEPanda OKsetname Sets the modules name to “Panda”
194+
184195
AT+PIN1234 OKsetPIN Set the PIN to 1234
196+
185197
*/
186198

187199
#include <SoftwareSerial.h>
200+
188201
SoftwareSerial BTserial(2, 3); // BT_TX | BT_RX
202+
189203
// Connect the HC-06 TX to the Arduino RX on pin 2.
204+
190205
// Connect the HC-06 RX to the Arduino TX on pin 3.
191206

192207

208+
193209
void setup()
210+
194211
{
212+
195213
Serial.begin(9600);
214+
196215
Serial.println("Enter AT commands:");
197216

198217
// HC-06 default serial speed is 9600
218+
199219
BTserial.begin(9600);
220+
200221
}
201222

202223
void loop()
224+
203225
{
204226

205227
// Keep reading from HC-06 and send to Arduino Serial Monitor
228+
206229
if (BTserial.available())
230+
207231
{
232+
208233
Serial.write(BTserial.read());
234+
209235
}
210236

211237
// Keep reading from Arduino Serial Monitor and send to HC-06
238+
212239
if (Serial.available())
240+
213241
{
242+
214243
BTserial.write(Serial.read());
244+
215245
}
216246

217247
}

0 commit comments

Comments
 (0)