Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- //NOTA: após fazer os comandos AT, tirar o fio do pino 5, e então o Bluetooth entrara em modo de uso normal
- //Alguns Comandos ATs:
- //AT+NAME=<nomeDoDispositivoBT> -> altera o nome de display do bluetooth
- //AT+PSWD=<senha> -> altera a senha do bluetooth
- SoftwareSerial BTSerial(8, 9); // RX | TX //Conectar o TX do Bluetooth no 8 //Conectar o RX do Bluetooth no 9
- void setup()
- {
- pinMode(5, OUTPUT);
- digitalWrite(5, HIGH); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
- Serial.begin(9600);
- Serial.println("Digite AT Comandos:");
- 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());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement