/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: "GSM Communication"
- Source Code NOT compiled for: Arduino Nano ESP32
- Source Code created on: 2024-06-13 11:07:14
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* initialize gsm */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include //https://github.com/plerup/espsoftwareserial
#include //https://github.com/vittorioexp/Sim800L-Arduino-Library-revised
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
void updateOutputs(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t gsm_SIM800L_RING_PIN_D3 = 3;
/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
const uint8_t gsm_SIM800L_RST_PIN_D2 = 2;
const uint8_t gsm_SIM800L_DTR_PIN_D4 = 4;
/***** DEFINITION OF Software Serial *****/
const uint8_t gsm_SIM800L_Serial_PIN_SERIAL_TX_A0 = A0;
const uint8_t gsm_SIM800L_Serial_PIN_SERIAL_RX_A1 = A1;
SoftwareSerial gsm_SIM800L_Serial(gsm_SIM800L_Serial_PIN_SERIAL_RX_A1, gsm_SIM800L_Serial_PIN_SERIAL_TX_A0);
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool gsm_SIM800L_RST_PIN_D2_rawData = 0;
bool gsm_SIM800L_DTR_PIN_D4_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float gsm_SIM800L_RST_PIN_D2_phyData = 0.0;
float gsm_SIM800L_DTR_PIN_D4_phyData = 0.0;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
Sim800L GSM(gsm_SIM800L_Serial_PIN_SERIAL_RX_A1, gsm_SIM800L_Serial_PIN_SERIAL_TX_A0, gsm_SIM800L_RST_PIN_D2);
void setup(void)
{
// put your setup code here, to run once:
pinMode(gsm_SIM800L_RING_PIN_D3, INPUT_PULLUP);
pinMode(gsm_SIM800L_RST_PIN_D2, OUTPUT);
pinMode(gsm_SIM800L_DTR_PIN_D4, OUTPUT);
gsm_SIM800L_Serial.begin(9600); // Initialize software serial communication
GSM.begin(9600); // Initialize GSM module with baud rate 9600
Serial.begin(9600); // Initialize serial communication for debugging
Serial.println("GET PRODUCT INFO: ");
Serial.println(GSM.getProductInfo());
Serial.println("GET OPERATORS LIST: ");
Serial.println(GSM.getOperatorsList());
Serial.println("GET OPERATOR: ");
Serial.println(GSM.getOperator());
}
void loop(void)
{
// put your main code here, to run repeatedly:
updateOutputs(); // Refresh output data
}
void updateOutputs()
{
digitalWrite(gsm_SIM800L_RST_PIN_D2, gsm_SIM800L_RST_PIN_D2_rawData);
digitalWrite(gsm_SIM800L_DTR_PIN_D4, gsm_SIM800L_DTR_PIN_D4_rawData);
}
/* END CODE */