Hi everyone. I am still new in this area. Please help me
I have a question where I run the program but there is none of output display at the serial monitor.
I'm using SIM800L ESP32 GSM module as microcontroller. I connect Piezoelectric Shock Sensor and GPS module at the GSM module. Here is the program code:
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#define SIM800L_AXP192_VERSION_20200327
#define DUMP_AT_COMMANDS
#define TINY_GSM_DEBUG SerialMon
#include "utilities.h"
#define SerialMon Serial
#define SerialAT Serial1
// Configure TinyGSM library
#define TINY_GSM_MODEM_SIM800 // Modem is SIM800
#define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb
#include <TinyGsmClient.h>
#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger);
#else
TinyGsm modem(SerialAT);
#endif
// Set phone numbers, if you want to test SMS and Calls
#define SMS_TARGET "<REDACTED>"
#define CALL_TARGET "<REDACTED>"
SoftwareSerial ss(18, 19); // RX, TX pins for GPS module
TinyGPSPlus gps;
void setup() {
Serial.begin(115200);
ss.begin(115200);
// Set console baud rate
SerialMon.begin(115200);
//delay(10);
// Start power management
if (setupPMU() == false) {
Serial.println("Setting power error");
}
// Some start operations
setupModem();
// Set GSM module baud rate and UART pins
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
//delay(6000);
}
void loop() {
int val = analogRead(27); // Connect the analog piezoelectric ceramic vibration sensor to analog pin 27
// Serial.print("value: ");
// Serial.println(val,DEC);
if (val >= 300) {
while (ss.available() > 0) {
if (gps.encode(ss.read())) {
if (gps.location.isValid()) {
float latitude = gps.location.lat();
float longitude = gps.location.lng();
Serial.print("value force: ");
Serial.println(val,DEC);
Serial.print("Latitude: ");
Serial.println(latitude, 6);
Serial.print("Longitude: ");
Serial.println(longitude, 6);
Serial.println(" ");
// Restart takes quite some time
// To skip it, call init() instead of restart()
SerialMon.println("Initializing modem...");
modem.restart();
//delay(10000); //delay execution for 10 second (10000ms -->10s)
String imei = modem.getIMEI();
//DBG("IMEI:", imei);
bool res = modem.sendSMS(SMS_TARGET, String("Alert Notification!\nYour motorcycle is in danger. Please check your motorcycle location below: ") );
}
}
}
}
delay(100);
}
I also import 2 header file which is StreamDebugger.h and utilities.h.
How should i fix this issues?
Thanks.