Regardez le datasheet. Il n'y a pas de commandes AT+VER?
ou AT+VERS
. Ils sont AT+VERR?
et AT+VERS?
.
J'ai fait quelques tests avec un HC-06 et certaines commandes nécessitaient un CR, d'autres non. Peut-être que c'est aussi votre problème?
J'ai utilisé ce code dans une esquisse Arduino pour configurer le nom du périphérique BT pour un HC-06:
// Enter AT command mode
if (enterATCommandMode() == true)
{
// Set the name. As we don't have an end-of-line mark, we need to wait until the
// timeout is reached and hope for the best. We also check whether the reply starts
// with "OK", so have at least some indication things worked.
hc06.print("AT+NAME" + userInput);
String reply = hc06.readString();
if (reply.equals(""))
{
Serial.println(F("HC-06 didn't reply in time!"));
}
else
{
if (reply.length() < 2 || !reply.substring(0,2).equalsIgnoreCase(F("OK")))
Serial.println("Unexpected answer ('" + reply + "') to AT+NAME command!");
else
Serial.println(F("Name was set successfully."));
}
}
bool enterATCommandMode()
{
// This buffer receives at most 2 characters as the reply (plus terminating \0)
char atReplyBuffer[] = { '\0', '\0', '\0' };
// Send AT command and receive answer
hc06.print(F("AT"));
int bytesRead = hc06.readBytesUntil('\0', atReplyBuffer, 2);
String reply = String(atReplyBuffer);
// Timed out or answer wasn't OK? Error.
if (bytesRead != 2 || !reply.equalsIgnoreCase(F("OK")))
{
if (reply.equals(""))
Serial.println(F("HC-06 didn't reply in time!"));
else
Serial.println("Unexpected reply ('" + reply + "') to AT command");
return false;
}
// Success
return true;
}
Merci Thorsten pour votre information. Peut-être que j'avais une mauvaise et ancienne fiche technique. Maintenant, le AT + VERS? commande fonctionne et répond HM-10 avec la chaîne HMsoft V540. – Ferrari
Merci Thorsten pour votre info. Peut-être que j'avais une mauvaise et ancienne fiche technique. Maintenant, le AT + VERS? commande fonctionne et répond HM-10 avec la chaîne HMsoft V540. J'ai aussi ajouté '\ r', '\ n' à la fin de la chaîne AT + NAMEaa mais je n'ai pas reçu de réponse de HM-10 – Ferrari
@Ferrari Est-il nécessaire d'entrer en mode de commande AT comme dans mon exemple? L'avez-vous fait? –