I need help to understand where the mistake is

#include <Arduino.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <UniversalTelegramBot.h>
#include <Adafruit_Sensor.h>
#include <TinyGPSplus.h>
#include <IRremote.h>

const char* ssid = "*****************";
const char* password = "**************************";

#define BOT_TOKEN "****************************"
#define CHAT_ID "*******************"

WiFiClient client;
UniversalTelegramBot bot(BOT_TOKEN, client);

#define CAM_SCL 21
#define CAM_SDA 22
#define CAM_VSYNC 23
#define CAM_HREF 25
#define CAM_D0 26
#define CAM_D1 27
#define CAM_D2 14
#define CAM_D3 12
#define CAM_D4 13
#define CAM_D5 15
#define CAM_D6 2
#define CAM_D7 0
#define CAM_RESET 4
#define CAM_PWDN 5

#define MIC_SEL 34
#define MIC_LRCL 35
#define MIC_DOUT 32
#define MIC_BCLK 33

#define GPS_PPS 19
#define GPS_RXD 17 
#define GPS_TXD 16

#define IR_RECEIVER 18

#define TAKE_PHOTO 0x1FE807F
#define START_AUDIO 0x1FE40BF
#define STOP_AUDIO 0x1FE20DF
#define START_VIDEO 0x1FEC03F
#define STOP_VIDEO 0x1FE20DF
#define GET_LOCATION 0x1FEF807


IRrecv irrecv(IR_RECEIVER);
decode_results results;

TinyGPSPlus gps;
double latitude = 0.0; 
double longitude = 0.0;

void setup() {

Serial.begin(115200);

WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}

Serial.println("Connected to WiFi");

irrecv.enableIRIn();

}

void loop() {

if (irrecv.decode(&results)) {
  if (results.value == TAKE_PHOTO) {
  // Code to take photo with camera module
  Serial.println("Taking photo..."); 
  
  // Code to send photo to Telegram bot
  bot.sendPhoto(CHAT_ID, "photo.jpg", "This is a photo");
}

if (results.value == START_AUDIO) {
  // Code to start audio recording
  
  Serial.println("Starting audio recording...");
}

if (results.value == STOP_AUDIO) {  
  // Code to stop audio recording

  Serial.println("Stopping audio recording...");
  
  // Code to send audio clip to Telegram bot
 bot.sendMessage(CHAT_ID, "audio.mp3", "This is an audio clip");
}

if (results.value == START_VIDEO) {
  // Code to start video recording
  
  Serial.println("Starting video recording...");
}

if (results.value == STOP_VIDEO) {
  // Code to stop video recording
  
  Serial.println("Stopping video recording...");

  // Code to send video to Telegram bot  
  bot.sendMessage(CHAT_ID, "video.mp4", "This is a video");   
}

if (results.value == GET_LOCATION) {
  Serial.println("Getting GPS location...");
  
// Code to get GPS location 
      if (gps.location.isValid()) {
        latitude = gps.location.lat();
        longitude = gps.location.lng();

        // Code to send location to Telegram bot
        String locationMessage = "Location: " + String(latitude, 6) + ", " + String(longitude, 6);
        bot.sendMessage(CHAT_ID, locationMessage.c_str(), "");
      } else {
        Serial.println("Invalid GPS location");
      }
    }

    irrecv.resume();
  }
}

I use ESP32-WROVER-E and this is the code I use, but nothing is sent to the Telegram bot, knowing that I have made sure that the Wi-Fi network name, password, Telegram token and ID are correct

At what point does it fail
What shows up in Serial Monitor, What doesn't
Does it start
Do you have the onboard LED
Not enough information ....

If you have all your libraries installed, the sketch compiles correctly...

To find and download these library files...

IDE >> SKETCH >> INCLUDE LIBRARIES >> LIBRARY MANAGER

Then type the names from the list above to search for them.
If you see the "INSTALL" button, click it to install the library.

2 posts were split to a new topic: No loop? (and a few more characters)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.