Problems (connecting to) blynk cloud

I’m having trouble communicating with the blynk cloud, I can not connect, look!

I’m a new user and I’m restricted, so I put my code in dontpad, here’s the link
http://dontpad.com/codein

Hello. We need a lot more information before we can do much.

What is your code, details of hardware device (AKA how are you attempting to get the UNO online), wiring and power connections, etc?

Have you looked at the documentations and searched this forum for key words like UNO, shield, etc?

http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/esp8266-with-at-firmware

My project is to send the reading of a current sensor to the network
I’m using an arduino Uno and a w5100 ethernet shield, with wired connection with my router wireless

// BIBLIOTECAS NECESSÁRIAS
#include <EmonLib.h>    // Emon Library : cálculos para os sensores.
#include <SPI.h>        // SPI Library : necessária para o Shield Ethernet.
#include <Ethernet.h>   // Ethernet Library : para o comunicação com a nuvem.
#define BLYNK_PRINT Serial // Enviar dados para o Serial
#include <BlynkSimpleEthernet.h> //Conexão do blynk com a internet

// VARIÁVEIS GLOBAIS
EnergyMonitor emon1;    
const int CT_PIN = 1;   

byte ip[]   = {192,168,  0,191};                      
byte gw[]   = {192,168,  0,  1};                      
byte ns[]   = {  8,  8,  8,  8};                      
byte sub[]  = {255,255,255,  0};                     
byte mac[]  = { 0x90, 0xA2, 0xDA, 0x0E, 0x04, 0x21 }; 
EthernetClient client;    

void setup()
{ 
  delay(10000);
 
  Serial.println("\n\nTCC ELETROTEC... CARREGANDO!");

  // Inicializa o monitor de energia.
  emon1.current(CT_PIN, 64);    

  // Inicializa o Shield Ethernet utilizando DHCP.
  Serial.print("Inicializando Ethernet com DHCP...");
  if (Ethernet.begin(mac) == 0) 
  { 
    Serial.println("falhou.");
    Serial.print("Inicializando com IP fixo...");
    Ethernet.begin(mac,ip,ns,gw,sub);
    Serial.println("feito!");
    //Serial.println("Aplicação interrompida.");
    //while(1);   // Fica em loop indefinidamente (aplicação interrompida).
  } 
  else
  {
    Serial.println("feito!");
  }
  delay(1000);
  Serial.print("Endereço IP: ");
  Serial.println(Ethernet.localIP()); 

  Serial.println("Iniciando medições: \n");
  
  char auth[] = "2546b3826bd14630ba35df48ebafc0b5"; 

  pinMode(1, OUTPUT);
 
  Blynk.begin(auth);
  Blynk.begin(auth, "blynk-cloud.com", 80);
  //Blynk.begin(auth, IPAddress(---,---,-,--), 80);
}

// Envia dados para servidor.
void sendData(double Irms, double Potencia) 
{
  
  client.connect("192.168.0.190",4000); 
  delay(500);
  
  if (client.connected())
  {
    client.print("GET /medida?");
    client.print("irms=");
    client.print(Irms);
    client.print("&potencia=");
    client.print(Potencia);
    client.println(" HTTP/1.1");
    client.println("Host: 192.168.0.190");
    client.println();
    delay(500);

    while (client.available())
    {
      char c = client.read();
    }

    delay(100);
    client.stop();
    Serial.println("Dados enviados!");
  } 
  else
  {
    Serial.println("Falha na conexão.");
  }
}


void loop()
{
 
  double Irms = emon1.calcIrms(1480); 
  double Potencia = Irms * 0.0;   
  Serial.print("Irms: ");
  Serial.print(Irms);  
  Serial.print(" A \t");
  Serial.print("Potencia: ");
  Serial.print(Potencia); 
  Serial.print(" W");
  Serial.println();

 
  sendData(Irms, Potencia);

 
  delay(2000);

  Blynk.run();
}

I’ve edited your post to insert the code instead of having a link to the external site where your code was posted.

You should read this:

Pete.

2 Likes