Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- //SIM800 TX is connected to Arduino
- #define SIM800_TX_PIN 10
- #define SIM800_RX_PIN 11
- SoftwareSerial serialSIM800(SIM800_TX_PIN, SIM800_RX_PIN);
- void setup() {
- Serial.println("SIM800 AT commander");
- //Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
- Serial.begin(9600);
- while (!Serial);
- //Being serial communication witj Arduino and SIM800
- serialSIM800.begin(9600);
- delay(1000);
- pinMode(10, OUTPUT);
- digitalWrite(10, HIGH);
- Serial.print("Fet on");
- }
- // --LOOP--
- void loop() {
- //Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
- if (serialSIM800.available()) {
- Serial.write(serialSIM800.read());
- }
- //Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
- if (Serial.available()) {
- serialSIM800.write(Serial.read());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement