Good day everyone! :)A newbie here. I just want to ask how to program a bluetooth using AT commands without entering or the need to type it on the Arduino IDE Serial Monitor. I mean, it is possible for me to insert AT commands on a program itself? If yes, can someone show me a sample code. My actual program should run like this, as i upload the program, it will automatically inquire nearby bluetooth devices.
Hoping for your help! Thank you! ![]()
You should connect your bluetooth module to other pins on teh Arduino and not use D0 and D1 as these are used for the PC interface
Look at SoftwareSerial http://arduino.cc/en/Reference/SoftwareSerial and connect your module to any two other data pins e.g. D10 and D11
e.g something like this
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX - THESE ARE THE PINS TO CONNECT TO YOUR BLUETOOTH DEVICE
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Bluetooth using SoftwareSerial");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);// SETUP DATA RATE FOR BLUETOOTH as appropriate
mySerial.println("AT+1234");// SEND SOME AT COMMAND
Serial.println("Command AT+1234 sent to Bluetooth");
}
void loop() // run over and over
{
}
@rogerClark Thank you sir for your response
:)! Will try to test that code later. Ill update you on improvements! ![]()