BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Variable or field 'BlynkWidgetWrite100' declared void

There have been other compiler issues with that function but should be ok now, see https://github.com/esp8266/Arduino/issues/546

Thanks.
Tracked by

1 Like

I just zoned into this topic and recalled that I have used that ADC_VCC() command before…

But it seems to compile fine for me… Core 2.4.0 (stable) & Blynk 0.5.0… Am I missing the gist of this topic? :thinking:

@GunnerTechTools try compiling this:

ADC_MODE(ADC_VCC);

#include <ESP8266WiFi.h>          // wifi
#include <BlynkSimpleEsp8266.h>   // blynk library

char auth[] = "YourAuthToken";
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  Blynk.begin(auth, ssid, pass);
}

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

BLYNK_WRITE(V101)
{}

It’s fine without the first line.

I found this old thread about a similar (same?) issue in an older version of the Arduino IDE:

One of the comments is “This seems to be caused by arduino-builder not generating correct forward declarations for functions marked with extern C.”

and this workaround was found:

Add a new Tab with file adc.h
with one line:
ADC_MODE(ADC_VCC)

add
#include "adc.h"
as first include in first tab.

I tried this and the code now compiles:

I’ve not tried tweaking the code to write the voltage readings to Blynk or the serial monitor, so I don’t know if it truly fixes the problem - I need a coffee and some breakfast first! :coffee::fried_egg::bacon:

Pete.

4 Likes

I saw that yesterday too but I believe it was a “bug” in the Arduino IDE that was quickly fixed.

Compiles for me too.

Well, who knows :stuck_out_tongue: If I built the sketch up from top to bottom, it was the last line that stopped it for me.

Still, my sketch with the same ADC_MODE(ADC_VCC); not only compiles, but works…

image


I have had strange compiling errors from something as simple as leaving an IDE open too long (save, close and reopen exact same script and works again)… and even chased issues around for over an hour once, tearing apart multiple scripts, before realising the fault was the latest update of the Dallas 1-wire library… reverted back and everything compiling again.

I am amazed these things work anyhow… so naughty and complex :stuck_out_tongue:

@GunnerTechTools the compiler is wrong there is nothing wrong with the last line of code.

That’s my point… the compiler often doesn’t indicate the actual issue… and it could be almost anything, including that the compiler is simply mistaken.

I have proven that ADC command compiles and works within a current Blynk script, so the question becomes, what is the other conditions that can cause the compile error… line position, empty loops or functions, unkind words toward the PC…

1 Like

I believe it relates to the position of the ADC_MODE() on this occasion.

I concure…

Naughty and complex :stuck_out_tongue:

4 Likes

indeed, if i put the ADC_MODE(ADC_VCC); right after the includes, it compiles.
thanks @GunnerTechTools!

however, the official docs are antinomic, regarding this.

here it says:
ADC_MODE(ADC_VCC);
This line has to appear outside of any functions, for instance right after the #include lines of your sketch.

but here says:
Add the following line to the top of your sketch

well, for me, top of the sketch != right after the include lines

i hope it will work ok this way! thanks again everybody for the advices!

1 Like

7 posts were split to a new topic: Compiling on a Mega using BlynkSimpleEthernet2

probably just a conflict of priorities with the Blynk Libraries preferring some code first and the Core doing the same… code egos… the start of the robot uprising :robot:

1 Like

All this is really weird. For example, BLYNK_PRINT macro goes before Blynk*.h, and still works fine…

after all, i rather think the problem is on the esp core side, not the blynk library side.

they already had such compilation problems several years ago with this macro. i thought to open a topic on the esp core git, i’m courious what they will say?

maybe will do that this weekend…

1 Like

@wanek the problem is that it’s any macro that comes before the Blynk libraries so more likely a Blynk issue than an ESP core issue.

@Costas how comes is it any macro? BLYNK_PRINT works somehow… ?

@vshymanskyy see test code at Macro_fail: compile error on Zero (and probably other platforms)

well, i’m not an expert in this. currently i’m happy that it compiles and i can use the code. on the long term, still, probably a better solution is needed.

on my side i consider this case as solved. if i can help you with anything else to debug this issue, please let me know!

1 Like