Untitled

 avatar
unknown
plain_text
10 months ago
632 B
17
Indexable
#include <SoftwareSerial.h>

// Choose two digital pins for RX and TX
// Arduino RX (pin 10) <- SIM800C TX
// Arduino TX (pin 11) -> SIM800C RX
SoftwareSerial sim800c(10, 11);

void setup() {
  // Serial monitor
  Serial.begin(9600);

  // SIM800C serial
  sim800c.begin(9600);

  delay(1000);
  Serial.println("Sending AT to SIM800C...");
  sim800c.println("AT");  // Test command
}

void loop() {
  // Forward data from SIM800C to Serial Monitor
  if (sim800c.available()) {
    Serial.write(sim800c.read());
  }

  // Forward data from Serial Monitor to SIM800C
  if (Serial.available()) {
    sim800c.write(Serial.read());
  }
}
Editor is loading...
Leave a Comment