Etape 4: Mode et HC-05 réinitialiser.
Dans la plupart des références, vous devrez manuellement déconnecter/reconnecter l’alimentation au HC-05 afin de mettre en mode (avec pin.34 mettre en haut) ou dos en mode données (avec le même NIP en état bas). Cela n’a aucun sens si votre application requiert de commutation en arrière dans l’ordre de/vers au mode commande.
L’astuce consiste à permettre l’Arduino contrôler la broche Reset (broche n ° 11) qui réinitialise le module. Le processus est le suivant
Pour mettre mode de commande :
digitalWrite(pinEn,HIGH); // Set the Enable pin (no.34) to HIGH, and keep it during the AT command digitalWrite(pinRe,LOW); // Set the Reset pin (no.11) to LOW, this postpones the module in preparation to reset delay(100); // A short delay (should be more that 10 ms) to simulate a negative pulse on the reset pin digitalWrite(pinRe,HIGH); // Set the Reset pin back to HIGH, and with Enable pin set to HIGH, the module restarts in AT Command mode.
Pour mettre en mode de transmission de données :
digitalWrite(pinEn,LOW); // Set the Enable pin (no.34) to LOW, and keep it during the data transmission modedigitalWrite(pinRe,LOW); // Set the Reset pin (no.11) to LOW, this postpones the module in preparation to reset delay(100); // A short delay (should be more that 10 ms) to simulate a negative pulse on the reset pin digitalWrite(pinRe,HIGH); // Set the Reset pin back to HIGH, and with Enable pin set to LOW, the module restarts in Data transmission mode.