SHARE
TWEET

Untitled

a guest Aug 2nd, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Timer.h"           // Side project
  2. #include <SoftwareSerial.h>
  3. // D2 == RX
  4. // D3 == TX
  5. // D4 == RST
  6. #define RX 2
  7. #define TX 3
  8. #define RST 4
  9. SoftwareSerial SIM8001(TX, RX);
  10.  
  11. Timer t;                      // Side project
  12. const byte ledPin = 13;       // Side project
  13. const byte interruptPin = A7; // Side project, including because "what if"
  14. int val = 0;
  15. volatile byte state = LOW;
  16.  
  17. void setup() {
  18.   pinMode(ledPin, OUTPUT);    // Side project
  19.   pinMode(RST, OUTPUT);
  20.   digitalWrite(RST, HIGH);
  21.  
  22.   Serial.begin(4800);
  23.   SIM8001.begin(4800);
  24. }
  25.  
  26. void loop() {
  27.   while (SIM8001.available()) {
  28.     Serial.write(SIM8001.read());
  29.   }
  30.   while (Serial.available()) {
  31.     digitalWrite(ledPin, HIGH); // Status check, if we're in this block or not.
  32.     SIM8001.write(Serial.read());
  33.     digitalWrite(ledPin, LOW);  // And a flash confirms that this block occurred.
  34.   }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top