Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. //SIM800 TX is connected to Arduino
  4. #define SIM800_TX_PIN 10
  5. #define SIM800_RX_PIN 11
  6.  
  7. SoftwareSerial serialSIM800(SIM800_TX_PIN, SIM800_RX_PIN);
  8.  
  9.  
  10.  
  11. void setup() {
  12. Serial.println("SIM800 AT commander");
  13.  
  14. //Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
  15. Serial.begin(9600);
  16. while (!Serial);
  17.  
  18. //Being serial communication witj Arduino and SIM800
  19. serialSIM800.begin(9600);
  20. delay(1000);
  21.  
  22. pinMode(10, OUTPUT);
  23. digitalWrite(10, HIGH);
  24. Serial.print("Fet on");
  25. }
  26.  
  27. // --LOOP--
  28. void loop() {
  29.  
  30. //Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
  31. if (serialSIM800.available()) {
  32. Serial.write(serialSIM800.read());
  33. }
  34. //Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
  35. if (Serial.available()) {
  36. serialSIM800.write(Serial.read());
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement