Stap 4: Configureren bluetooth
Kun je je bluetooth aan op opdrachtmodus door de invoering van de pin 34 van bluetooth op hoog
#include <softwareserial.h> SoftwareSerial BTSerial(4, 3); //RX|| TXvoid setup() { pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode digitalWrite(9, HIGH); Serial.begin(9600); Serial.println("Enter AT commands:"); BTSerial.begin(38400); // HC-05 default speed in AT command more }void loop() { // Keep reading from HC-05 and send to Arduino Serial Monitor if (BTSerial.available()) Serial.write(BTSerial.read()); // Keep reading from Arduino Serial Monitor and send to HC-05 if (Serial.available()) BTSerial.write(Serial.read()); } //upload the sketch //Then open the serial port select baud rate to 9600 and select NL&CR mode //Connect Tx and Rx of bluetooth pin to to 4,3 respectively // You can touch the pin 34 of bluetooth to pin 9 of arduino using a wire // disconnect the bluetooth while uploading the sketch as it will interrupt the uploading //now u can configure the baud rate of bluetooth ,give name to bluetooth ,set password to bluetooth.... //The file HC05 at command has codes to configure the bluetooth //In order to check ur connection Enter AT in Serial port it will reply OK//Enter " AT+UART=57600,0,0 " in serial port to change the baud rate of bluetooth