Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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: "SIM800L Management"
- - Source Code compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-06-13 10:57:23
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* initialize gsm */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <SoftwareSerial.h> //https://github.com/plerup/espsoftwareserial
- #include <Sim800L.h> //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 sim_SIM800L_RING_PIN_D16 = 16;
- /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
- const uint8_t sim_SIM800L_RST_PIN_D14 = 14;
- const uint8_t sim_SIM800L_DTR_PIN_D17 = 17;
- /***** DEFINITION OF Software Serial *****/
- const uint8_t sim_SIM800L_Serial_PIN_SERIAL_TX_D4 = 4;
- const uint8_t sim_SIM800L_Serial_PIN_SERIAL_RX_D13 = 13;
- EspSoftwareSerial::UART sim_SIM800L_Serial;
- /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
- /***** used to store raw data *****/
- bool sim_SIM800L_RST_PIN_D14_rawData = 0;
- bool sim_SIM800L_DTR_PIN_D17_rawData = 0;
- /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
- /***** used to store data after characteristic curve transformation *****/
- float sim_SIM800L_RST_PIN_D14_phyData = 0.0;
- float sim_SIM800L_DTR_PIN_D17_phyData = 0.0;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- Sim800L GSM(sim_SIM800L_Serial_PIN_SERIAL_RX_D13, sim_SIM800L_Serial_PIN_SERIAL_TX_D4, sim_SIM800L_RST_PIN_D14);
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(sim_SIM800L_RING_PIN_D16, INPUT_PULLUP);
- pinMode(sim_SIM800L_RST_PIN_D14, OUTPUT);
- pinMode(sim_SIM800L_DTR_PIN_D17, OUTPUT);
- sim_SIM800L_Serial.begin(9600, SWSERIAL_8N1, sim_SIM800L_Serial_PIN_SERIAL_RX_D13, sim_SIM800L_Serial_PIN_SERIAL_TX_D4, false);
- // Initialize GSM module with baud rate 9600
- GSM.begin(9600);
- Serial.begin(9600); // Initialize Serial for debugging
- // Debugging information
- 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(sim_SIM800L_RST_PIN_D14, sim_SIM800L_RST_PIN_D14_rawData);
- digitalWrite(sim_SIM800L_DTR_PIN_D17, sim_SIM800L_DTR_PIN_D17_rawData);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement