Error compiling my code

Hello i promise i have one last question, why can this not compile to genericesp8266 module i have posted the full error code below

Arduino: 1.8.5 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, nodemcu, 26 MHz, 40MHz, QIO, 4M (1M SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Archiving built core (caching) in: C:\Users\Andreas\AppData\Local\Temp\arduino_cache_432518\core\core_esp8266_esp8266_generic_CpuFrequency_80,ResetMethod_nodemcu,CrystalFreq_26,FlashFreq_40,FlashMode_qio,FlashSize_4M1M,led_2,LwIPVariant_v2mss536,Debug_Disabled,DebugLevel_None____,FlashErase_none,UploadSpeed_115200_dfdc24dd3789a8f5628d505c4510a3bf.a
sketch\Wifi_Setup_1.ino.cpp.o: In function `BlynkProtocol<BlynkArduinoClientGen<Client> >::sendCmd(unsigned char, unsigned short, void const*, unsigned int, void const*, unsigned int)':

C:\Users\Andreas\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkProtocol.h:533: undefined reference to `control()'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

#define BLYNK_PRINT Serial
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int knap2 = 0;
char auth[] = "e236694531b14249be3e47ca1b7da10b";
int knap = 2;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Andreas - iPhone";
char pass[] = "Benee1234";
int Lys = 0;
BlynkTimer timer;

void control();
BLYNK_WRITE(V3) //SliderWidget skriver til V3
  loop; {

    int knap = param.asInt();

  if (knap  == 0) {
    digitalWrite(13, LOW);
    Serial.println("knap er 0");
  else if (knap == 1) {
    digitalWrite(13, HIGH);
    Serial.println("knap er 1");
  else {
    int Lys = analogRead(A0);
    Serial.println("knap er 2");
    if (Lys > 500) {
      digitalWrite(13, HIGH);

    else {
      digitalWrite(13, LOW);

void setup()
  // Debug console
  pinMode(15, OUTPUT);
  pinMode(4, INPUT);
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(V3, INPUT);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, control);

//void button(){
//  loop();{

void loop() {;;


The problem is with the syntax of this function.
You shouldn’t have a semicolon at the end of this line, instead, the next character should be an opening curly bracket “{”

However, its not clear what you’re trying to achieve in the following lines of code, as the BLYNK_WRITE(V3) shouldn’t be within a function that’s being called by a timer.


Hello thank you for your help, what im trying to do is have a slider on the blynk app define what the led(gp13) is supposed to, so turned on, turned off, or according to a sensor

Could you help me, theb by telling where it is supposed to be

I think you’d be better studying some of the code that the sketch builder he erates and work through it line by line until you understand what it does nd why.

Throwing lots of random bits of code on there in the hope that it’ll work isn’t the best way to learn programming. Start with a simple BLYNK_WRITE(Vx) function and a Serial.print statement. Once you see the results then add-in one of the If statements and another couple of Serial.prints and send through a variety of different values from the slider in the app.
Don’t progress until you understNd what’s happening and why, then add the next If statement, and so on…