Advertisement
Experimentboy

Serial virtuel / SoftwareSerial - ExperimentBoy

Jul 30th, 2018
6,823
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial BTS(10, 11); // RX | TX
  4.  
  5. void setup()
  6. {
  7.   Serial.begin(9600);
  8.   Serial.write("Enter AT commands:");
  9.   BTS.begin(38400);  // HC-05 FC-114 default speed in AT command more
  10. }
  11.  
  12. void loop()
  13. {
  14.  
  15.   // Read from HC-05 and send it to Arduino Serial Monitor
  16.   if (BTS.available())
  17.   {
  18.     Serial.write(BTS.read());
  19.   }
  20.  
  21.   // Read from Arduino Serial Monitor and send to HC-05
  22.   if (Serial.available())
  23.     BTS.write(Serial.read());
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement