I am trying to convert a blynk code from Bluetooth to Wemos D1 r2 & mini (wifi)
I believe everything should be working, no errors when uploading and in the serial monitor, upon startup it connects to the internet all fine. but after load up it keeps looping this phrase:
[506987] Connecting to blynk-cloud.com:80 [509048] Login timeout
Wifi scetch-
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
You can receive x and y coords for joystick movement within App.
App project setup:
Two Axis Joystick on V1 in MERGE output mode.
MERGE mode means device will receive both x and y within 1 message
*************************************************************/
/* Comment this out to disable prints and save space */
#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[] = "746fe62d67dd4dbb90544671ccf54143";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "K-9 Wifi";
char pass[] = "Buster27";
int x,y;
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);
}
float LMotor_offset,RMotor_offset;
float Turn_Speed = 0, Turn_Speed_K = 0;
float Run_Speed = 0, Run_Speed_K = 0, Run_Speed_T = 0;
float LOutput=0;float ROutput=0;
//Variable en la que se va a almacenar el valor correspondiente a la distancia
int Dist,Dist1,Dist2;
// APP DEL MVIL
int MARCHA;
int INA=7;
int INB=8;
int ENA=5;
int INC=12;
int IND=4;
int ENB=9;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(INA,OUTPUT);
pinMode(INB,OUTPUT);
pinMode(INC,OUTPUT);
pinMode(IND,OUTPUT);
x=0;
y=0;
LOutput=0;
ROutput=0;
}
void loop()
{
Blynk.run(); // To Run Blynk
XY_TO_RUN_TURN_SPEEDS(); //X of the Joystick represent the turn speed and Y the RUN speed
PWMControl();// It controls the logic for the Motors H bridge
}
void XY_TO_RUN_TURN_SPEEDS(){
if(x!=128){
Turn_Speed=map(x,0,255,160,-160);
}else{
Turn_Speed=0;
}
if(y!=128){
Run_Speed=map(y,0,255,-300,300);
}else{
Run_Speed=0;
}
LOutput = Run_Speed + Turn_Speed;
ROutput = Run_Speed - Turn_Speed;
LOutput= -LOutput;
}
void PWMControl(){
if(LOutput > 0){
digitalWrite(INA, HIGH);
digitalWrite(INB, HIGH);
}
else if(LOutput < 0){
digitalWrite(INA, LOW);
digitalWrite(INB, LOW);
}
else{
digitalWrite(INA, HIGH);
digitalWrite(INB, HIGH);
}
if(ROutput > 0){
digitalWrite(INC, HIGH);
digitalWrite(IND, HIGH);
}
else if(ROutput < 0){
digitalWrite(INC, LOW);
digitalWrite(IND, LOW);
}
else{
digitalWrite(INC, HIGH);
digitalWrite(IND, HIGH);
}
}
I can post the original Bluetooth code if someone wants me to.
any help is appreciated