Issue with code (or Blynk) for RC Car



Hello! I am using an ESP32 (Dev Module) on WiFi to control an ESC and a servo of a RC car. The ESC requires a PWM signal thus why I have substituted analogWrite for ledcWrite. My problem is that the integer val is taking the value from V3 instead of V4 Because of this, when I change the value of V3, the ESC works when the servo is the only thing that should be working. I have limited experience and knowledge with ESP32’s and Blynk, hence why I have come here for help. I am currently using the Blynk Andriod app version 2.27.1 and I use Blynk’s servers and am using Blynk library version 0.5.4.

#include <Wire.h>
#include <Servo.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

//Blynk & Network Settings
char auth[] = "Nice";  
char ssid[] = "Try";
char pass[] = "Lmao";

//Code Goes Here
int val = 0;

Servo steering;


  val = param.asInt(); 

#define LEDC_CHANNEL_0     0
#define LEDC_TIMER_13_BIT  13
#define LEDC_BASE_FREQ     5000
#define LED_PIN            22

void ledcAnalogWrite(uint8_t channel, uint32_t value, uint32_t valueMax = 255) 
  ledcWrite(channel, val); 

void setup()
  ledcAttachPin(LED_PIN, LEDC_CHANNEL_0);
  Blynk.begin(auth, ssid, pass);

void loop()

Thanks in Advance,

Janith Hettiarachchi


How do you know that for sure? Your code says differently.


Because I am using a slider to change the value of V3, which is meant for the servo. The ESC also works when I move the slider for V3.


Well your different functions for V3 and V4 are different :stuck_out_tongue: so whatever crossover is happening has something to do with the servo library and your alternative for PWM ledcWrite as they may be unintentionally sharing some communication

This is an esp32 thing and not really Blynk specific as Blynk is probably working perfectly normal… Something you can confirm with simple feedback to display widgets, like V5 & V6

  BlynkvirtualWrite(V5, param.asInt());

  val = param.asInt(); 
  BlynkvirtualWrite(V6, param.asInt());


Hmm, when I try to compile your code, it gives me this error:

Arduino: 1.8.7 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default, QIO, 80MHz, 4MB (32Mb), 921600, None"

C:\Users\NeefoPlays\Documents\Arduino\wifi_dual_servos\wifi_dual_servos.ino: In function 'void BlynkWidgetWrite3(BlynkReq&, const BlynkParam&)':

wifi_dual_servos:21:38: error: 'BlynkvirtualWrite' was not declared in this scope

   BlynkvirtualWrite(V5, param.asInt());


C:\Users\NeefoPlays\Documents\Arduino\wifi_dual_servos\wifi_dual_servos.ino: In function 'void BlynkWidgetWrite4(BlynkReq&, const BlynkParam&)':

wifi_dual_servos:27:38: error: 'BlynkvirtualWrite' was not declared in this scope

   BlynkvirtualWrite(V6, param.asInt());


Multiple libraries were found for "WiFi.h"
 Used: C:\Users\NeefoPlays\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Multiple libraries were found for "Servo.h"
 Used: C:\Users\NeefoPlays\Documents\Arduino\libraries\ESP32_Arduino_Servo_Library
 Not used: C:\Program Files (x86)\Arduino\libraries\Servo
exit status 1
'BlynkvirtualWrite' was not declared in this scope

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


I would love to say I did that on purpose to see if you are simply doing the copy/paste scriptkiddy thing, or actually reading, examining and learning the commands… But alas that was just a simple syntax error on my part :blush:

Just fix the command syntax as I missed a period


Hmmm yeah you seem to be right, now the issue is fixing this issue :frowning:


Blynk.virtualWrite(V6, param.asInt()); not BlynkvirtualWrite(V6, param.asInt()); etc…


no not that issue lol, getting my esc to take the value of val.


Try using the ledcWrite method for the servo as well… at least long enough to see if there is a conflict or not (AKA remove the servo library).