BlynkWidgetWrite declared void in Arduino IDE 2.3.2

This is the code that i tried to compile:

#define BLYNK_TEMPLATE_ID "TMPL6OqZQZLmb"
#define BLYNK_TEMPLATE_NAME "arkoose"
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define ENA 16  // Enable/speed motors Right  GPIO16(D0)
#define ENB 5   // Enable/speed motors Left   GPIO5(D1)
#define IN_1 4  // L298N in1 motors Right     GPIO4(D2)
#define IN_2 0  // L298N in2 motors Right     GPIO13(D3)
#define IN_3 2  // L298N in3 motors Left      GPIO2(D4)
#define IN_4 14 // L298N in4 motors Left      GPIO0(D5)

const int MAX_SPEED = 255;  // Maximum speed value (0-255)
int Speed;

char auth[] = "BLABLABLBLA"; // Blynk auth token
char ssid[] = "dlinkl_31f3"; 
char pass[] = "953a9a"; 

int command = 0; // Variable to store command received from Python

void setup() {
  Serial.begin(9600);
  pinMode(ENA, OUTPUT);
  pinMode(IN_1, OUTPUT);
  pinMode(IN_2, OUTPUT);
  pinMode(IN_3, OUTPUT);
  pinMode(IN_4, OUTPUT);
  pinMode(ENB, OUTPUT);

  Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);  
}

====================
BLYNK_WRITE(V0) { 
  int command = param.asInt(); 
  }
=======================
void loop() {
  Blynk.run(); 
  executeCommand();
}

void executeCommand() {
  switch (command) {
    case 1: 
      carForward(); // Full speed forward
      break;
    case 2: 
      carBackward(); 
      break;
    case 3:
      carLeft();
      break;
    case 4:
      carRight();
      break;
    default:
      carStop(); // Stop if an invalid command is received
  }
}

// ... Your motor movement functions remain the same ... 
void carForward() {
  analogWrite(ENA, Speed);
  analogWrite(ENB, Speed);
  digitalWrite(IN_1, LOW);
  digitalWrite(IN_2, HIGH);
  digitalWrite(IN_3, HIGH);
  digitalWrite(IN_4, LOW);
}

void carBackward() {
  analogWrite(ENA, Speed);
  analogWrite(ENB, Speed);
  digitalWrite(IN_1, HIGH);
  digitalWrite(IN_2, LOW);
  digitalWrite(IN_3, LOW);
  digitalWrite(IN_4, HIGH);
}

void carLeft() {
  analogWrite(ENA, Speed);
  analogWrite(ENB, Speed);
  digitalWrite(IN_1, HIGH);
  digitalWrite(IN_2, LOW);
  digitalWrite(IN_3, HIGH);
  digitalWrite(IN_4, LOW);
}

void carRight() {
  analogWrite(ENA, Speed);
  analogWrite(ENB, Speed);
  digitalWrite(IN_1, LOW);
  digitalWrite(IN_2, HIGH);
  digitalWrite(IN_3, LOW);
  digitalWrite(IN_4, HIGH);
}

void carStop() {
  digitalWrite(IN_1, LOW);
  digitalWrite(IN_2, LOW);
  digitalWrite(IN_3, LOW);
  digitalWrite(IN_4, LOW);
}

Error are in here:
BLYNK_WRITE(V0) {
int command = param.asInt();
}

It says
C:\Users\nabil\OneDrive\Documents\Arduino\pingback\mobil.ino:42:6: error: variable or field ‘BlynkWidgetWrite’ declared void
42 | BLYNK_WRITE()
| ^~~~~~~~
C:\Users\nabil\OneDrive\Documents\Arduino\pingback\mobil.ino:42:23: error: ‘BlynkReq’ was not declared in this scope
42 | BLYNK_WRITE()
| ^
C:\Users\nabil\OneDrive\Documents\Arduino\pingback\mobil.ino:42:71: error: expected primary-expression before ‘const’
42 | BLYNK_WRITE()
| ^

exit status 1

Compilation error: variable or field ‘BlynkWidgetWrite’ declared void

What should i do at this point? because i saw previous post and it has simmilar issue but its on older version of arduino ide.

my project setup are:
ESP8266 WIFI
ARDUINO IDE 2.3.2
BLYNK 1.3.2 SG SERVER

Your code compiles fine for me (once the two “====================” lines are removed).

What board type are you choosing in the IDE?
What ESP8266 core version do you have installed in the IDE?

Pete.

1 Like

Hey there pete thanks for the reply. Im using esp8266 by community version 3.1.2 the board are 12e module

Me too.

“12e module” isn’t an available board type in the IDE.

Pete.

Its nodemcu 1.0 (ESP-12E MODULE)

It compiles fine for me with that board type.

Pete.

Hey Pete, the issue is resolved. I uninstalled and reinstalled the arduino ide(2.3.2 same version). It works and resolved. Thank you for the help Pete

1 Like