in this code, my 0, 4 th pin esp32 nodemcu give current when v1 is 0 .what is the reason for this?
#define BLYNK_TEMPLATE_ID "TMPL6JEP3FuoT"
#define BLYNK_TEMPLATE_NAME "MAAGII"
#define BLYNK_AUTH_TOKEN "ojZ5q-Lt79vTiIad4i9exesVqE_xUlbp"
#define BLYNK_PRINT Serial
//#define BLYNK_PRINT DebugSerial
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#include <Stepper.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
const int stepsPerRevolution = 100; // change this to fit the number of steps per revolution
//for your motor
Stepper myStepper(stepsPerRevolution, 2, 0, 4, 16);
int stepCount = 0;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "ojZ5q-Lt79vTiIad4i9exesVqE_xUlbp";
char ssid[]="maagii";
char pass[]="Pentium124";
int val;
int absl;
void setup()
{
// Debug console
DebugSerial.begin(9600);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
BLYNK_WRITE(V1)
{
int pinValue = param.asInt();
val = pinValue;
absl = abs(val);
}
void loop()
{
Blynk.run();
int motorSpeed = map(absl, 0, 1023, 0, 100);
if (motorSpeed > 0) {
myStepper.setSpeed(motorSpeed);
// step 1/100 of a revolution:
myStepper.step(((stepsPerRevolution*val)/absl) / 100);
}
}