"error: 'const void*' is not a pointer-to-object type" - what should i do guys?

i have project use arduino iot web editor to program my telegram bot notification, but when i compile the program it's always error (error: 'const void*' is not a pointer-to-object type). what should i do guys?

/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/00becaba-5a9d-4033-9c67-6fc6a9cfd877

Arduino IoT Cloud Variables description

The following variables are automatically generated and updated when changes are made to the Thing

  • No variables have been created, add cloud variables on the Thing Setup page
    to see them declared here

Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include "DHT.h"
#define DHTPIN D1
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);

// Initialize Telegram BOT
#define BOTtoken "5761670683:AAHuYxfQcGD3PtdA5tx1zaKUNFaPVIXgMAE" // diisi Token Bot (Dapat dari Telegram Botfather)

WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);

//Checks for new messages every 1 second.
int botRequestDelay = 1000;
unsigned long lastTimeBotRan;

void handleNewMessages(int numNewMessages) {
Serial.println("handleNewMessages");
Serial.println(String(numNewMessages));

for (int i=0; i<numNewMessages; i++) {
String chat_id = String(bot.messages[i].chat_id);
String text = bot.messages[i].text;

String from_name = bot.messages[i].from_name;
if (from_name == "") from_name = "Guest";

//Cek Pembacaan Sensor DHT11
if (text == "/statussuhu") {
  int t = dht.readTemperature()-2;
   String temp = "Suhu saat ini : ";
   temp += int(t);
   temp +=" *C\n";
  
  bot.sendMessage(chat_id,temp, "");
}
if (text == "/statuskelembapan") {
  int h = dht.readHumidity();
   String temp = "Kelembaban: ";
   temp += int(h);
   temp += " %";
 
  bot.sendMessage(chat_id,temp, "");
}

//Cek Command untuk setiap aksi
if (text == "/start") {
  String welcome = "Welcome  " + from_name + ".\n";
  welcome += "/statussuhu : Status Suhu\n";
  welcome += "/statuskelembapan : Status Kelembapan\n";
  bot.sendMessage(chat_id, welcome, "Markdown");
}

}
}

void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found

dht.begin();
// This is the simplest way of getting this working
// if you are passing sensitive information, or controlling
// something important, please either use certStore or at
// least client.setFingerPrint
client.setInsecure();

// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);

// attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(SSID);
WiFi.begin(SSID, PASS);

while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}

Serial.println("");
Serial.println("WiFi connected");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

delay(1500);

// Defined in thingProperties.h
initProperties();

// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);

/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}

void loop() {
ArduinoCloud.update();
// Your code here

int t = dht.readTemperature()-2;
int h = dht.readHumidity();
if (millis() > lastTimeBotRan + botRequestDelay) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);

while(numNewMessages) {
  Serial.println("got response");
  handleNewMessages(numNewMessages);
  numNewMessages = bot.getUpdates(bot.last_message_received + 1);
}

lastTimeBotRan = millis();

}

}

Images of code snippets and error messages are nearly worthless.

Read the "how to get the best from the forum" post to see how to post code and error messages.

Post all the code.

Post the entire error message. Use the "copy error message" button in the IDE.

Here is your code in one code box:

/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/00becaba-5a9d-4033-9c67-6fc6a9cfd877 1

Arduino IoT Cloud Variables description

The following variables are automatically generated and updated when changes are made to the Thing

    No variables have been created, add cloud variables on the Thing Setup page
    to see them declared here

Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include "DHT.h"
#define DHTPIN D1
#define DHTTYPE DHT11  // DHT 11
DHT dht(DHTPIN, DHTTYPE);

// Initialize Telegram BOT
#define BOTtoken "5761670683:AAHuYxfQcGD3PtdA5tx1zaKUNFaPVIXgMAE"  // diisi Token Bot (Dapat dari Telegram Botfather)

WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);

//Checks for new messages every 1 second.
int botRequestDelay = 1000;
unsigned long lastTimeBotRan;

void handleNewMessages(int numNewMessages) {
  Serial.println("handleNewMessages");
  Serial.println(String(numNewMessages));

  for (int i = 0; i < numNewMessages; i++) {
    String chat_id = String(bot.messages[i].chat_id);
    String text = bot.messages[i].text;

    String from_name = bot.messages[i].from_name;
    if (from_name == "") from_name = "Guest";

    //Cek Pembacaan Sensor DHT11
    if (text == "/statussuhu") {
      int t = dht.readTemperature() - 2;
      String temp = "Suhu saat ini : ";
      temp += int(t);
      temp += " *C\n";

      bot.sendMessage(chat_id, temp, "");
    }
    if (text == "/statuskelembapan") {
      int h = dht.readHumidity();
      String temp = "Kelembaban: ";
      temp += int(h);
      temp += " %";

      bot.sendMessage(chat_id, temp, "");
    }

    //Cek Command untuk setiap aksi
    if (text == "/start") {
      String welcome = "Welcome  " + from_name + ".\n";
      welcome += "/statussuhu : Status Suhu\n";
      welcome += "/statuskelembapan : Status Kelembapan\n";
      bot.sendMessage(chat_id, welcome, "Markdown");
    }
  }
}

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found

  dht.begin();
  // This is the simplest way of getting this working
  // if you are passing sensitive information, or controlling
  // something important, please either use certStore or at
  // least client.setFingerPrint
  client.setInsecure();

  // Set WiFi to station mode and disconnect from an AP if it was Previously
  // connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  // attempt to connect to Wifi network:
  Serial.print("Connecting Wifi: ");
  Serial.println(SSID);
  WiFi.begin(SSID, PASS);

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  delay(1500);

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);

  /*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  // Your code here

  int t = dht.readTemperature() - 2;
  int h = dht.readHumidity();
  if (millis() > lastTimeBotRan + botRequestDelay) {
    int numNewMessages = bot.getUpdates(bot.last_message_received + 1);

    while (numNewMessages) {
      Serial.println("got response");
      handleNewMessages(numNewMessages);
      numNewMessages = bot.getUpdates(bot.last_message_received + 1);
    }

    lastTimeBotRan = millis();
  }
}

Cast it to the type of data it is pointing to.

Hi, I did run into the same error. It looks it is caused by library version problems. The webeditor is using "older" esp software library ,2.5.0 instead of 3.1.0 I was using in my project. For me the errors did disappear by removing library’s/downgrading/moving the downgraded library’s in the custom library tab. In my project it involved TimeLib, SPI and Wire.
Benno

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