CPP 212
HC05/NOROUZI & ZIVDAR Guest on 3rd February 2024 07:19:30 AM
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial mySerial(3, 2); // RX, TX
  4.  
  5. void setup() {
  6.   // Open serial communications and wait for port to open:
  7.   Serial.begin(9600);
  8.   while (!Serial) {
  9.     ; // wait for serial port to connect. Needed for native USB port only
  10.   }
  11.  
  12.  
  13.   Serial.println("Goodnight moon!");
  14.  
  15.   // set the data rate for the SoftwareSerial port
  16.   mySerial.begin(9600);
  17.   mySerial.println("Hello, world?");
  18. }
  19.  
  20. void loop() { // run over and over
  21.   if (mySerial.available()) {
  22.     Serial.write(mySerial.read());
  23.   }
  24.   if (Serial.available()) {
  25.     mySerial.write(Serial.read());
  26.   }
  27. }

Hightechrobo bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.