Yeap, exactly as you are describing…
1 Like
I don’t think many people reading this topic thought that a new NodeMCU and motor shield would produce a different result.
Did you ever remove the cover over the front steering and work out whether it was a servo or motor?
Did you try monitoring the voltages on the output pins of the shield, running a demo sketch etc?
Pete.
No I haven’t tried yet.ok would do that.
Front is the motor not servo.
I ordered Arduino shield today.can anyone could help me with the code so I could get it work with blynk.
Well, that’s a step backwards - especially if you want to use it with Blynk.
Pete.
Sir here is the code finally steering blynk joystick does move the RC left,right and other for fwd, backward. the issue is I am not being able to control the RC properly as it disconnects or takes time to halt any suggestion for proper handling with code.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XrALdZIsmiphdZ-S2dsDbGkJhT*****";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*********";
char pass[] = "*********";
int PWMA=5;//Right side
int PWMB=4;//Left side
int DA=0;//Right reverse
int DB=2;//Left reverse
void setup(){
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(PWMA, OUTPUT);
pinMode(PWMB, OUTPUT);
pinMode(DA, OUTPUT);
pinMode(DB, OUTPUT);
}
void loop(){
Blynk.run();
}
// Handling Joystick data
BLYNK_WRITE(V2){
int x = param[0].asInt();
int y = param[1].asInt();
if(x==1 && y==0){ //RIGHT
Serial.print("right v2");
digitalWrite(PWMB, HIGH);
digitalWrite(DB, LOW);
}else if(x==-1 && y==0){ //LEFT
Serial.print("left v2");
digitalWrite(PWMB, HIGH);
digitalWrite(DB, HIGH);
}else if(x==0 && y==0){ //Stay
Serial.print("stay v2");
digitalWrite(PWMA, LOW);
digitalWrite(DA, LOW);
digitalWrite(PWMB, LOW);
digitalWrite(DB, LOW);
}
}
BLYNK_WRITE(V1){
int x = param[0].asInt();
int y = param[1].asInt();
if(x==1 && y==0){ //fwd
Serial.print("fwd v1");
digitalWrite(PWMA, HIGH);
digitalWrite(DA, LOW);
}else if(x==-1 && y==-0){ //back
Serial.print("back v1");
digitalWrite(PWMA, HIGH);
digitalWrite(DA, HIGH);
}
else if(x==0 && y==0){ //Stay
Serial.print("stay v1");
digitalWrite(PWMA, LOW);
digitalWrite(DA, LOW);
digitalWrite(PWMB, LOW);
digitalWrite(DB, LOW);
}
}