[moved] Code suddenly gives error "Error compiling of board Arduino Mega..."

I have placed this topic in "Programing Questions" because it is more an arduino board issue then a Networking issue, since it connects to the blynk server, but won't compile.
Sorry for the inconvinice.
New topic

Hi,

I am working on some IOT project with Blynk.
Yesterday my code compiled fine, but suddenly it gives an error.

Arduino:1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board:"Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:16:0,

                 from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/BlynkApiArduino.h:14,

                 from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Adapters/BlynkEthernet.h:24,

                 from C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEthernet2.h:20,

                 from C:\Users\Isaak\Desktop\Arduino_Ethernet2\Arduino_Ethernet2.ino:4:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h: In instantiation of 'void BlynkParam::add_multi(T) [with T = float (*)(); Args = {}]':

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:81:9:   required from 'void BlynkApi<Proto>::virtualWrite(int, Args ...) [with Args = {float (*)()}; Proto = BlynkProtocol<BlynkArduinoClientGen<Client> >]'

C:\Users\Isaak\Desktop\Arduino_Ethernet2\Arduino_Ethernet2.ino:128:40:   required from here

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:112:9: error: no matching function for call to 'add(float (*&)())'

         add(last);

         ^~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:231:10: note: candidate: void BlynkParam::add(int) <near match>

     void BlynkParam::add(int value)

          ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:231:10: note:   conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:239:10: note: candidate: void BlynkParam::add(unsigned int) <near match>

     void BlynkParam::add(unsigned int value)

          ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:239:10: note:   conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:247:10: note: candidate: void BlynkParam::add(long int) <near match>

     void BlynkParam::add(long value)

          ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:247:10: note:   conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:255:10: note: candidate: void BlynkParam::add(long unsigned int) <near match>

     void BlynkParam::add(unsigned long value)

          ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:255:10: note:   conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:263:10: note: candidate: void BlynkParam::add(long long int) <near match>

     void BlynkParam::add(long long value)  // TODO: this currently adds just a long

          ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:263:10: note:   conversion of argument 1 would be ill-formed:

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:271:10: note: candidate: void BlynkParam::add(long long unsigned int) <near match>

     void BlynkParam::add(unsigned long long value) // TODO: this currently adds just a long

          ^~~~~~~~~~

C:\Users\Isaak\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkParam.h:271:10: note:   conversion of argument 1 would be ill-formed:

exit status 1

Fout bij het compileren voor board Arduino Mega or Mega 2560

It looks like it has to do with the library and i removed code until the error went away, and this is the piece of code that caused it (i think).

void myTimerEvent() {
  Blynk.virtualWrite(V10, BMP_return('T'));
  Blynk.virtualWrite(V12, BH1750_return);
}

whole program (if anyone needs it...)

//U8lib
#include <U8glib.h>
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_FAST);
void draw() {
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 20);
  u8g.print("Hello World!");
}
void U8glib_print() {
  u8g.firstPage();
  do {
    draw();
  } while ( u8g.nextPage() );
}

// KEYPAD
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3', '4'},
  {'5', '6', '7', '8'},
  {'9', 'A', 'B', 'C'},
  {'D', 'E', 'F', 'G'}
};
byte rowPins[ROWS] = {29, 27, 25, 23};
byte colPins[COLS] = {22, 24, 26, 28};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
char Keypad_return() {
  char customKey = customKeypad.getKey();
  if (customKey) {
    return customKey;
  }
}
bool Keypad_ask(char ask) {
  char customKey = customKeypad.getKey();
  if (customKey == ask) {
    return LOW;
  }
  else {
    return HIGH;
  }
}



//DHT
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 48
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);

float DHT_return(char selector = 'H') {
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  if ( selector == 'H') {
    if (isnan(event.temperature)) {
    }
    else {
      return event.temperature;
    }
  }
  else if ( selector == 'T') {
    sensors_event_t event;
    dht.humidity().getEvent(&event);
    if (isnan(event.relative_humidity)) {
    }
    else {
      return event.relative_humidity;
    }
  }
}

//BH1750
#include <BH1750.h>
BH1750 lightMeter;
float BH1750_return() {
  return lightMeter.readLightLevel() * 10;
}

//BMP
#include <Wire.h>
#include "SparkFunBME280.h"
BME280 BMP;
float BMP_return(char selector = 'T') {
  if (selector == 'T') {
    return BMP.readTempC();
  } else if (selector == 'F') {
    return BMP.readTempF();
  } else if (selector == 'H') {
    return BMP.readFloatHumidity();
  } else if (selector == 'P') {
    return BMP.readFloatPressure();
  }
}

//RELAY
byte relay[4] = {34, 35, 36, 37};

// EEPROM
#include <EEPROM.h>
#define SETTINGS_AMOUNT 1
byte currentSettings[SETTINGS_AMOUNT];

void updateSettings() {
  for (int i = 0; i < SETTINGS_AMOUNT; i++) {
    EEPROM.update(i, currentSettings[i]);
  }
}
void getSettings() {
  for (int i = 0; i < SETTINGS_AMOUNT; i++) {
   currentSettings[i] = EEPROM.read(i);
  }
}

//BlynkTimer timer;

void myTimerEvent() {
  Blynk.virtualWrite(V10, BMP_return('T'));
  Blynk.virtualWrite(V12, BH1750_return);
}



void setup() {
  Serial.begin(9600);

  Blynk.begin(auth);
  timer.setInterval(1000L, myTimerEvent);

  dht.begin();
  lightMeter.begin();
  BMP.setI2CAddress(0x76);
  if (BMP.beginI2C() == false) Serial.println("BMP connect failed");

  getSettings();

}

void loop() {
  Blynk.run();
}

I am using an WW5500 Ethernet module, it works with the Blynk test (it connects to the server).
I recompiled it many times (some other topics said that that might work).
and i didn't mess with te library...
edit: deleting and reinstalling the blynk library didn't fix it either.

Does anyone know how to solve this issue? I would really appreciate it!

Isaak

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