DuboisP

HC05config.ino

Feb 5th, 2026
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | Source Code | 0 0
  1. // https://retroetgeek.com/arduino/configuration-du-module-hc-05-pour-arduino/
  2. // https://www.aranacorp.com/fr/votre-arduino-communique-avec-le-module-hc-05/
  3.  
  4. #include <SoftwareSerial.h>
  5.  
  6. // Mapping Arduino Digital ports to Bluetooth Serial
  7. //#define rxPin 5
  8. //#define txPin 4
  9. #define rxPin A4
  10. #define txPin A5
  11.  
  12. #define atmodePin 9
  13. #define baudrate 38400
  14.  
  15. SoftwareSerial hc05(rxPin, txPin);
  16.  
  17. void setup() {
  18.  
  19.    // passage en mode AT
  20.    pinMode(atmodePin, OUTPUT);
  21.    digitalWrite(atmodePin, HIGH);
  22.  
  23.    Serial.begin(9600);
  24.    Serial.println("ENTER AT Commands:");
  25.    hc05.begin(baudrate);
  26. }
  27.  
  28. void loop() {
  29.  
  30.    if (hc05.available())
  31.       Serial.write(hc05.read());
  32.  
  33.    if (Serial.available())
  34.       hc05.write(Serial.read());
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment