App not working, cannot display the reading

Before creating the topic

I am using :
• Arduino UNO with Ethernet Shield
• Android + version 5.1.1
• local server
• Blynk Library version
• Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

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

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "code";

IPAddress server_ip (192, 168, 43, 49);

// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip (192,168,137,88);
IPAddress dns_ip     (192, 168, 43, 1);
IPAddress gateway_ip (192, 168, 43, 1);
IPAddress subnet_mask(255, 255, 255, 0);

#define W5100_CS  10
#define SDCARD_CS 4

#define DHTPIN 7     // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT22     // DHT 22

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

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

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  Blynk.begin(auth, server_ip, 9443, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
  //You can also specify server:
  //Blynk.begin(auth);
  //Blynk.begin(auth, "localhost name", 80);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8080);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

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

error

So your local server is on the 192.168.43.xxx subnet, and that’s the same as your router/gateway, but you’re assigning a static IP to your Arduino on the 192.168.137.xxx subnet.

As the Arduino won’t be able to see your router or your local server it will never be able to connect.

Pete.

2 Likes

Now its work, thank you pete :smiley:

2 Likes