Connecting errors


Hi.

I do not know what happens that I lose connection so much, what can I do to find out what is happening … It never happened to me, I have been with blynk for 4 years and I never had problems.

She also left the code.

#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "";
#define BLYNK_DEVICE_NAME "Arduino Mega";
#define BLYNK_AUTH_TOKEN ""

#define BLYNK_FIRMWARE_VERSION        "1.2"

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

BlynkTimer timer;

#define W5100_CS  10
#define SDCARD_CS 4


const int ReflectorPatio = 24;
const int Presurizadora = 26;
const int TimerPresurizadora = 34;

const int ReflectorPorton = 53;
const int ReflectorTerreno = 43;

int EstadoReflectorPatio = LOW;
int EstadoPresurizadora = LOW;
int EstadoReflectorPorton = LOW;
int EstadoReflectorTerreno = LOW;
int EstadoTimerPresurizadora = LOW;



void setup()
{
  // Debug console
  Serial.begin(9600);

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH);

  pinMode(ReflectorPatio, OUTPUT);
  pinMode(Presurizadora, OUTPUT);
  pinMode(TimerPresurizadora, OUTPUT);

  pinMode(ReflectorPorton, OUTPUT);
  pinMode(ReflectorTerreno, OUTPUT);

  Blynk.begin(BLYNK_AUTH_TOKEN);


  digitalWrite(ReflectorPatio, HIGH);
  digitalWrite(Presurizadora, HIGH);
  digitalWrite(ReflectorPorton, HIGH);
  digitalWrite(ReflectorTerreno, HIGH);

}


BLYNK_WRITE(V2) {
  EstadoReflectorPatio = param.asInt();
  digitalWrite(ReflectorPatio, EstadoReflectorPatio);
  Blynk.virtualWrite(V2, EstadoReflectorPatio);
}
BLYNK_WRITE(V3) {
  EstadoPresurizadora = param.asInt();
  digitalWrite(Presurizadora, EstadoPresurizadora);
  Blynk.virtualWrite(V3, EstadoPresurizadora);

  if (EstadoPresurizadora == 0) {
    Blynk.virtualWrite(V14, "Presurizada");
  }
  else {
    Blynk.virtualWrite(V14, "Normal");
  }

}

BLYNK_WRITE(V4) {
  EstadoTimerPresurizadora = param.asInt();
  digitalWrite(TimerPresurizadora, EstadoTimerPresurizadora);
  Blynk.virtualWrite(V4, EstadoTimerPresurizadora);
}

BLYNK_WRITE(V5) {
  EstadoReflectorPorton = param.asInt();
  digitalWrite(ReflectorPorton, EstadoReflectorPorton);
  Blynk.virtualWrite(V5, EstadoReflectorPorton);
}
BLYNK_WRITE(V6) {
  EstadoReflectorTerreno = param.asInt();
  digitalWrite(ReflectorTerreno, EstadoReflectorTerreno);
  Blynk.virtualWrite(V6, EstadoReflectorTerreno);
}


BLYNK_WRITE(V7)
{
  EstadoTimerPresurizadora = param.asInt();
  digitalWrite(TimerPresurizadora, EstadoTimerPresurizadora);
  Blynk.virtualWrite(V7, EstadoTimerPresurizadora);
}

void loop()
{
  Blynk.run();
  timer.run();
}

any help there ? idk what happend i check cables , internet and all its fine…

Pin 53 is the SS (CS) pin that’s used by the Ethernet shield when attached to a Mega. It is connected via the ICSP connector in the middle of the board.

You have to avoid pins 50-53 when using an Ethernet shield on a Mega.

Pete.

Hi Pete, thx.

my monitor show me this…

but app show me connection lost every 1 or 2 hours.

And what changes have you made to your code?

Pete.

const int ReflectorPorton = 53;
to
const int ReflectorPorton = 48;

I keep receiving notifications from the blynk application that the notification was lost and is driving me crazy. But I don’t know if it really loses the connection because I could never “not use it” it is always available every time I need it.
imagen

@EscuderoKevin you can turn off “offline” notifs in the settings (left top menu item)

@Dmitriy But that’s not the solution, is it a bug?

@EscuderoKevin I don’t know. It’s hard to say. You need to experiment with your firmware. Start from the simplest possible sketch and move forward.

@Dmitriy is that I use the same code since I use blynk, I only updated it when v2 came out, but I never had problems, it began to pass from 1 day to the other as if it were simply disconnected but in reality the monitor does not show me what it is I disconnect …

I don’t think you’ve previously been successfully using the same code on the same hardware, as the code you originally posted used pin which clashed with the Mega/Ethernet connection.
This would have caused issues in any situation, not just with Blynk IoT.

Pete.

I understand it, but as I told you, I have been using it for almost 2 years with the same code. Change when I upgrade to v2, but always use the same hard and code