Mithun_K_Das
Advanced Member level 3
- Joined
- Apr 24, 2010
- Messages
- 899
- Helped
- 24
- Reputation
- 48
- Reaction score
- 26
- Trophy points
- 1,318
- Location
- Dhaka, Bangladesh, Bangladesh
- Activity points
- 8,254
We know that we can scan nearby Bluetooth devices through our phones. But how we can scan nearby available Bluetooth devices using Bluetooth modules such as HC-05/06 or JDY-08 etc?
Thanks in advance.
I used this code after reading that the HC05 can find the scan list.
But there is nothing except just 'OK' in return
Thanks in advance.
--- Updated ---
I used this code after reading that the HC05 can find the scan list.
Code:
#include <SoftwareSerial.h>
SoftwareSerial Bluetooth(6, 5);
String readstr;
void setup()
{
Serial.begin(9600);
Bluetooth.begin(38400);
// Bluetooth.begin(115200);
Bluetooth.print("AT+ROLE=1\r\n"); delay(1000);
Bluetooth.print("AT+CMODE=1\r\n"); delay(1000);
Bluetooth.print("AT+INIT\r\n"); delay(1000);
Bluetooth.print("AT+IAC=9e8b33\r\n"); delay(1000);
Bluetooth.print("AT+CLASS=1f1f\r\n"); delay(1000);
Bluetooth.print("AT+INQM=1,2,20\r\n"); delay(1000);
Serial.println("BT Scan result: ");
}
void loop()
{
Bluetooth.print("AT+INQ\r\n");
delay(10);
while (Bluetooth.available())
{
delay(10);
char c = Bluetooth.read();
readstr += c;
}
if (readstr.length() > 0)
{
Serial.print("BT response:");
Serial.println(readstr);
readstr = "";
delay(3000);
}
delay(2000);
}
But there is nothing except just 'OK' in return
Last edited by a moderator: