Smart Home Automation Forum
[arduino code examples for G1]-05 GSM test - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=66)
+--- Forum: G1 (https://www.kincony.com/forum/forumdisplay.php?fid=67)
+--- Thread: [arduino code examples for G1]-05 GSM test (/showthread.php?tid=7180)



[arduino code examples for G1]-05 GSM test - admin - 12-06-2024

Code:
#include <HardwareSerial.h>

// Define serial port
HardwareSerial SimSerial(1); // Use hardware serial port 1 (GPIO9 and GPIO10)

void setup() {
  // Initialize USB serial port (default serial port 0)
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for USB serial port to connect
  }

  // Initialize SIM7600 serial port
  SimSerial.begin(115200, SERIAL_8N1, 9, 10); // RX=GPIO9, TX=GPIO10
  //Serial.println("ESP32-S3 begin work");
}

void loop() {
  // If data is received from the computer, forward it to the SIM7600 module
  if (Serial.available()) {
    while (Serial.available()) {
      char data = Serial.read();
      SimSerial.write(data);
    }
  }

  // If data is received from the SIM7600 module, forward it to the computer
  if (SimSerial.available()) {
    while (SimSerial.available()) {
      char data = SimSerial.read();
      Serial.write(data);
    }
  }
}
arduino ino file download: 

.zip   5-GSM-Test.zip (Size: 598 bytes / Downloads: 57)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 

.zip   5-GSM-Test.ino.merged.zip (Size: 184.08 KB / Downloads: 56)