Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/********* 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 Management" - Source Code NOT compiled for: Arduino Pro Mini 5V - Source Code created on: 2024-06-13 11:04:24 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* Develop a system to control a SIM800L GSM module */ /* using an Arduino. The system should handle */ /* incoming calls via the RING pin and manage power */ /* states using the RST and DTR pins. Communication */ /* occurs over SoftwareSerial on pins A0 and A1. */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include
#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 tre_SIM800L_RING_PIN_D3 = 3; /***** DEFINITION OF DIGITAL OUTPUT PINS *****/ const uint8_t tre_SIM800L_RST_PIN_D2 = 2; const uint8_t tre_SIM800L_DTR_PIN_D4 = 4; /***** DEFINITION OF Software Serial *****/ const uint8_t tre_SIM800L_Serial_PIN_SERIAL_TX_A0 = A0; const uint8_t tre_SIM800L_Serial_PIN_SERIAL_RX_A1 = A1; SoftwareSerial tre_SIM800L_Serial(tre_SIM800L_Serial_PIN_SERIAL_RX_A1, tre_SIM800L_Serial_PIN_SERIAL_TX_A0); /***** DEFINITION OF OUTPUT RAW VARIABLES *****/ /***** used to store raw data *****/ bool tre_SIM800L_RST_PIN_D2_rawData = 0; bool tre_SIM800L_DTR_PIN_D4_rawData = 0; /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/ /***** used to store data after characteristic curve transformation *****/ float tre_SIM800L_RST_PIN_D2_phyData = 0.0; float tre_SIM800L_DTR_PIN_D4_phyData = 0.0; /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/ Sim800L GSM(&tre_SIM800L_Serial, tre_SIM800L_RST_PIN_D2, tre_SIM800L_DTR_PIN_D4, tre_SIM800L_RING_PIN_D3); void setup(void) { // Initialize serial communication for debugging Serial.begin(9600); // Set pin modes pinMode(tre_SIM800L_RING_PIN_D3, INPUT_PULLUP); pinMode(tre_SIM800L_RST_PIN_D2, OUTPUT); pinMode(tre_SIM800L_DTR_PIN_D4, OUTPUT); // Initialize the software serial for GSM communication tre_SIM800L_Serial.begin(9600); // Initialize the GSM module GSM.begin(4800); // Set minimum functionality mode if (!GSM.setFunctionalityMode(0)) Serial.println("ERROR"); else Serial.println("Minimum functionality"); Serial.print("Functionality mode: "); Serial.println(GSM.getFunctionalityMode()); delay(5000); // Set full functionality mode if (!GSM.setFunctionalityMode(1)) Serial.println("ERROR"); else Serial.println("Full functionality"); Serial.print("Functionality mode: "); Serial.println(GSM.getFunctionalityMode()); delay(5000); // Set flight mode (disable RF function) if (!GSM.setFunctionalityMode(4)) Serial.println("ERROR"); else Serial.println("Flight mode (disable RF function)"); Serial.print("Functionality mode: "); Serial.println(GSM.getFunctionalityMode()); delay(5000); } void loop(void) { // Refresh output data updateOutputs(); // Check for incoming calls via the RING pin if (digitalRead(tre_SIM800L_RING_PIN_D3) == LOW) { Serial.println("Incoming call detected!"); // Handle the incoming call as needed } } void updateOutputs() { // Update the output pins with the raw data digitalWrite(tre_SIM800L_RST_PIN_D2, tre_SIM800L_RST_PIN_D2_rawData); digitalWrite(tre_SIM800L_DTR_PIN_D4, tre_SIM800L_DTR_PIN_D4_rawData); } /* END CODE */
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)