sj0091
January 12, 2023, 4:38am
1
my code is-
#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
#define BLYNK_AUTH_TOKEN "2T-Iv5jVEBwrvW7zfwLkFnXnyspPSD3W" //Enter your blynk auth token
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "realme 5i";//Enter your WIFI name
char pass[] = "ssssssss";//Enter your WIFI password
Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;
int motor1Pin = 0; // Pin for motor 1
int motor2Pin = 1; // Pin for motor 2
int motor3Pin = 2; // Pin for motor 3
int motor4Pin = 4; // Pin for motor 4
int motor1Speed = 0; // Speed of motor 1
int motor2Speed = 0; // Speed of motor 2
int motor3Speed = 0; // Speed of motor 3
int motor4Speed = 0; // Speed of motor 4
void setup() {
motor1.attach(motor1Pin);
motor2.attach(motor2Pin);
motor3.attach(motor3Pin);
motor4.attach(motor4Pin);
Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
}
void loop() {
Blynk.run();
}
BLYNK_WRITE(V1) {
motor1Speed = param[0].asInt();
motor1Speed = map(motor1Speed, 0, 1023, 1000, 2000);
motor1.writeMicroseconds(motor1Speed);
}
BLYNK_WRITE(V2) {
motor2Speed = param[0].asInt();
motor2Speed = map(motor2Speed, 0, 1023, 1000, 2000);
motor2.writeMicroseconds(motor2Speed);
}
BLYNK_WRITE(V3) {
motor3Speed = param[0].asInt();
motor3Speed = map(motor3Speed, 0, 1023, 1000, 2000);
motor3.writeMicroseconds(motor3Speed);
}
BLYNK_WRITE(V4) {
motor4Speed = param[0].asInt();
motor4Speed = map(motor4Speed, 0, 1023, 1000, 2000);
motor4.writeMicroseconds(motor4Speed);
}
please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly. Triple backticks look like this: ```
1 Like
sj0091
January 12, 2023, 5:51am
3
#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
#define BLYNK_AUTH_TOKEN "2T-Iv5jVEBwrvW7zfwLkFnXnyspPSD3W" //Enter your blynk auth token
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "--0----";//Enter your WIFI name
char pass[] = "---------";//Enter your WIFI password
Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;
int motor1Speed = 0; // Speed of motor 1
int motor2Speed = 0; // Speed of motor 2
int motor3Speed = 0; // Speed of motor 3
int motor4Speed = 0; // Speed of motor 4
void setup() {
motor1.attach(D0);
motor2.attach(D1);
motor3.attach(D2);
motor4.attach(D4);
Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
}
void loop() {
Blynk.run();
}
BLYNK_WRITE(V1) {
motor1Speed = param[0].asInt();
motor1Speed = map(motor1Speed, 0, 1023, 1000, 2000);
motor1.writeMicroseconds(motor1Speed);
}
BLYNK_WRITE(V2) {
motor2Speed = param[0].asInt();
motor2Speed = map(motor2Speed, 0, 1023, 1000, 2000);
motor2.writeMicroseconds(motor2Speed);
}
BLYNK_WRITE(V3) {
motor3Speed = param[0].asInt();
motor3Speed = map(motor3Speed, 0, 1023, 1000, 2000);
motor3.writeMicroseconds(motor3Speed);
}
BLYNK_WRITE(V4) {
motor4Speed = param[0].asInt();
motor4Speed = map(motor4Speed, 0, 1023, 1000, 2000);
motor4.writeMicroseconds(motor4Speed);
}
John93
January 12, 2023, 5:57am
4
@sj0091 please don’t create multiple topics on the same subject and keep the discussion in one place.
“blynk-cloud.com ” is the old blynk server. The new blynk server is"blynk.cloud".
Also, there’s no need to specify a server, just add the
#define BLYNK_TEMPLATE_ID "TMPLxxxxxx"
#define BLYNK_DEVICE_NAME "Device"
#define BLYNK_AUTH_TOKEN "YourAuthToken"
At the top of your sketch and use
Blynk.begin(auth, ssid, pass);
Instead.
1 Like