Advertisement
Guest User

Bluetoo Comando AT

a guest
Apr 7th, 2014
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2. //NOTA: após fazer os comandos AT, tirar o fio do pino 5, e então o Bluetooth entrara em modo de uso normal
  3. //Alguns Comandos ATs:
  4. //AT+NAME=<nomeDoDispositivoBT>   -> altera o nome de display do bluetooth
  5. //AT+PSWD=<senha>                 -> altera a senha do bluetooth
  6. SoftwareSerial BTSerial(8, 9); // RX | TX //Conectar o TX do Bluetooth no 8  //Conectar o RX do Bluetooth no 9
  7. void setup()
  8. {
  9.   pinMode(5, OUTPUT);  
  10.   digitalWrite(5, HIGH); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  11.  
  12.   Serial.begin(9600);
  13.   Serial.println("Digite AT Comandos:");
  14.   BTSerial.begin(38400);  // HC-05 default speed in AT command more
  15.  
  16. }
  17.  
  18. void loop()
  19. {
  20.  
  21.   // Keep reading from HC-05 and send to Arduino Serial Monitor
  22.   if (BTSerial.available())
  23.   {
  24.     Serial.write(BTSerial.read());
  25.   }
  26.   // Keep reading from Arduino Serial Monitor and send to HC-05
  27.   if (Serial.available())
  28.   {
  29.     BTSerial.write(Serial.read());
  30.   }
  31.  
  32.    
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement