HI , i am working a simple robot project . i want to control 2 dc motor using adafruit motor shield , but there is no response in the motor i am dam sure the blynk is not communicating with my adafruit motor shield .
Hardware used : Arduino mega 2560 + Adafruit motor shield + Enc28j60 Ethernet shield + ,
i used a 2 axis joystick for the increment of the motor speed but i couldn’t able to see a rotation on the motor i had attached the code below which is used , can any one fig out my mistake plzzzzzzzzzzzzzzzzz
#define BLYNK_PRINT Serial `` #include <AFMotor.h> #include <UIPEthernet.h> #include <BlynkSimpleUIPEthernet.h>
i gone through with getdata example and wrote this code #define BLYNK_PRINT Serial #include <UIPEthernet.h> #include <BlynkSimpleUIPEthernet.h> #include <AFMotor.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
AF_DCMotor motor1(1, MOTOR12_64KHZ);
AF_DCMotor motor2(2, MOTOR12_64KHZ);
char auth[] = “99f402fee7e44d8f85aa550d550a8819”;
// This function will be called every time
// when App writes value to Virtual Pin 1
BLYNK_WRITE(V1)
{
BLYNK_LOG(“Got a value: %s”, param.asStr());
// You can also use:
// int i = param.asInt() or
// double d = param.asDouble()
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);
if(y>220)
motor1.run(FORWARD);
else if(y<35)
motor1.run(BACKWARD);
else if(x>220)
motor2.run(FORWARD);
else if(x<35)
motor2.run(BACKWARD);
}
void loop()
{
Blynk.run();
}
surprisingly i got the value of X,Y in serial monitor but there is no movement in the motor. can you help me out of this plz .
.