Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. /**
  2. * Para renomear conecte o bluetooth ao arduino ligando os pinos:
  3. *
  4. * En -> Pino 9 do arduino
  5. * VCC -> +5Vcc do arduino
  6. * GND -> GND do arduino
  7. * Rx -> Pino 10 arduino
  8. * Tx -> Pino 11 do arduino
  9. *
  10. * Antes de ligar o arduino e o modulo bluetooth segure pressionado no botão que existe no modulo bluetooth, e então ligue a alimentação. Segure ate que o modulo comece a piscar lentamente.
  11. * Abra a Serial do arduino e digite:
  12. * AT
  13. * O modulo deve responder:
  14. * OK
  15.  
  16. * Agora digite:
  17. * AT+NAME=novo-nome
  18. *
  19. * O modulo deve responder:
  20. * OK
  21. */
  22.  
  23. #include <SoftwareSerial.h>
  24.  
  25. SoftwareSerial BTSerial(10, 11); // RX | TX
  26.  
  27. void setup() {
  28. pinMode(9, OUTPUT);
  29. digitalWrite(9, HIGH);
  30. Serial.begin(9600);
  31. Serial.println("Enter AT commands:");
  32. BTSerial.begin(38400);
  33. }
  34.  
  35. void loop() {
  36. if (BTSerial.available())
  37. Serial.write(BTSerial.read());
  38.  
  39. if (Serial.available())
  40. BTSerial.write(Serial.read());
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement