Hello,
I currently want to get data values of the blynk joystick again and again to make different Conditional statements true. Actually I want to check the data in middle of a conditional statement named Forward Movement
This is the code
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <AccelStepper.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "LRTCZUnCI06P-pqh5rlPXRbuOUgQ_uGH";
AccelStepper stepper_1(1,D8,D7);
AccelStepper stepper_2(1,D5,D6);
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Airtel_7599998800";
char pass[] = "air71454";
BLYNK_WRITE(V1) {
int x = param[0].asInt();
int y = param[1].asInt();
// Do something with x and y
Serial.print("X = ");
Serial.print(x);
Serial.print("; Y = ");
Serial.println(y);
MoveControls(x , y);
}
void setup()
{
// Debug console
Serial.begin(9600);
stepper_1.setAcceleration(1000);
stepper_2.setAcceleration(1000);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
}
void MoveControls(int x, int y) {
///////////////////////////////////////////Move Forward////////////////////////////////////////////////////
while(y >= 150 && x <= 150 && x >= -150){
stepper_1.enableOutputs();
stepper_2.enableOutputs();
stepper_1.setMaxSpeed(1000);
stepper_2.setMaxSpeed(1000);
stepper_1.move(2000);
stepper_2.move(2000);
stepper_1.run();
stepper_2.run();
*// I want to check the Pin values here //*
Blynk.run();
}
///////////////////////////////////////////Neutral Zone////////////////////////////////////////////////////
while(y <= 150 && x <= 150 && x >= -150 && y >= -150){
stepper_1.disableOutputs();
stepper_2.disableOutputs();
Blynk.run();
}
}