Skip to main content
deleted 2 characters in body
Source Link
tepalia
  • 168
  • 5

You can edit your code like this.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  Serial.begin(1152009600); // Monitor baud rate to match A9G
  mySerial.begin(115200); // Set to A9G baud rate

  Serial.println("A9G Module Communication Test");
  
  // Send AT command with carriage return and line feed
  mySerial.print("AT\r\n");
  delay(1000); // Wait for response
}

void loop() {
  // Check if data is available from the A9G module
  if (mySerial.available()) {
    // Read the data from the A9G module
    while (mySerial.available()) {
      char c = mySerial.read();
      Serial.write(c); // Send it to the Serial Monitor
    }
  }

  // Check if data is available from the Serial Monitor
  if (Serial.available()) {
    // Read the data from the Serial Monitor
    while (Serial.available()) {
      char c = Serial.read();
      mySerial.write(c); // Send it to the A9G module
    }
  }
}

You can edit your code like this.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  Serial.begin(115200); // Monitor baud rate to match A9G
  mySerial.begin(115200); // Set to A9G baud rate

  Serial.println("A9G Module Communication Test");
  
  // Send AT command with carriage return and line feed
  mySerial.print("AT\r\n");
  delay(1000); // Wait for response
}

void loop() {
  // Check if data is available from the A9G module
  if (mySerial.available()) {
    // Read the data from the A9G module
    while (mySerial.available()) {
      char c = mySerial.read();
      Serial.write(c); // Send it to the Serial Monitor
    }
  }

  // Check if data is available from the Serial Monitor
  if (Serial.available()) {
    // Read the data from the Serial Monitor
    while (Serial.available()) {
      char c = Serial.read();
      mySerial.write(c); // Send it to the A9G module
    }
  }
}

You can edit your code like this.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  Serial.begin(9600); // Monitor baud rate to match A9G
  mySerial.begin(115200); // Set to A9G baud rate

  Serial.println("A9G Module Communication Test");
  
  // Send AT command with carriage return and line feed
  mySerial.print("AT\r\n");
  delay(1000); // Wait for response
}

void loop() {
  // Check if data is available from the A9G module
  if (mySerial.available()) {
    // Read the data from the A9G module
    while (mySerial.available()) {
      char c = mySerial.read();
      Serial.write(c); // Send it to the Serial Monitor
    }
  }

  // Check if data is available from the Serial Monitor
  if (Serial.available()) {
    // Read the data from the Serial Monitor
    while (Serial.available()) {
      char c = Serial.read();
      mySerial.write(c); // Send it to the A9G module
    }
  }
}
Source Link
tepalia
  • 168
  • 5

You can edit your code like this.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  Serial.begin(115200); // Monitor baud rate to match A9G
  mySerial.begin(115200); // Set to A9G baud rate

  Serial.println("A9G Module Communication Test");
  
  // Send AT command with carriage return and line feed
  mySerial.print("AT\r\n");
  delay(1000); // Wait for response
}

void loop() {
  // Check if data is available from the A9G module
  if (mySerial.available()) {
    // Read the data from the A9G module
    while (mySerial.available()) {
      char c = mySerial.read();
      Serial.write(c); // Send it to the Serial Monitor
    }
  }

  // Check if data is available from the Serial Monitor
  if (Serial.available()) {
    // Read the data from the Serial Monitor
    while (Serial.available()) {
      char c = Serial.read();
      mySerial.write(c); // Send it to the A9G module
    }
  }
}