My app is offline when I click play

:sweat_smile:

Hello guys,

I am new to Blynk, I am testing my first app, I’ve built my app with a name “Climate Control” and using Wemos D1 ESP8266 standalone board that is connected to my phone’s hotspot. As you can see, I’ve configured both the ssid & password there in the code, as well as the auth key.

Previously, I’ve tried the ESP8266 with DHT22 sensor and it displays both temperature and humidity readings on serial monitor. Means, my Wemos ESP8266 board is working.

So now, why my app says Climate Control is offline because my phone’s hotspot is also connecting to the PC I’m using now and I can browse the internet.

Your kind help is highly appreciated.

The issue isn’t with your app, and is instead with your hardware. It would appear you named your device and your app the same, hence it’s telling you your device is offline.

… we can’t see your code, although it would be helpful for you to post it here :slight_smile: (Remember to put it between triple back-ticks ``` around your code)

That may be your issue. Some mobile hotspots will block the Blynk traffic to the server.

But, it could be any number of other things and without seeing your code and serial monitor output, plus knowing your hardware, phone O/S, Blynk library version etc. etc. etc. it’s impossible to say.

Pete.

1 Like

here is my code

//Maps the pins on the Wemos D1 for D0-D10 to Arduino pin layout
#define D0 3
#define D1 1
#define D2 16
#define D3 5
#define D4 4
#define D5 14
#define D6 12
#define D7 13
#define D8 0
#define D9 2
#define D10 15

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


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "iPhone X";
char pass[] = "me083009";

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

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11     // DHT 11
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

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);

  Serial.print(t);        // Print temperature to the Serial Port
  Serial.print("°C  ");   // Write unit of Celsius
  Serial.print(h);        // Print humidity to the Serial Port
  Serial.print("RH  ");   // Write unit of RH, relative humidity (0-100%)
  Serial.println();       // Write newline
}

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

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, 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();
}```

Can we see serial out as well?

Have you tried running it on another WiFi network?

above is the serial monitor, I use iPhone X with the latest iOS 12.4

here is the serial output

and my device setup

You don’t need to reply to both of us <3, one post would suffice. It seems your issue is with connecting to the Blynk cloud, I would recommend you try and use another network if you haven’t already and then see what difference that makes.

oh sorry for replying to both persons :smiley:

and now I connect to different wifi, which is a hotspot from another PC named HPECL3

so is that what I suppose to get?

That’s the one!
Yep, you should see the device online if you look it the app :slight_smile:

Yay! I win the prize! :trophy: :trophy: :trophy:

Pete.

1 Like

yeay… you’re right :+1::+1::+1:

I got it running on my app :wink:

by the way, based on the two sensor readings displayed on my app, can I set a condition like when both readings reach 50, then Blynk app will turn on an LED at my Wemos device?

Short answer - Yes!

Slightly longer answer - Yes, but you’ll need to learn some C++ coding skills. People on this forum will help you with technical Blynk issues, but what you’ve described has nothing at all to do with Blynk.
Time invested in learning C++ will pay dividends, as I can guarantee that once you’ve written the code to turn on this LED under these circumstances, you’ll also come up with other enhancements that you’ll want to add.

You’ll be looking at code that says something like…

if (reading1 >= 50 && reading2 >= 50)
{
 digitalWrite(myLEDpin, HIGH);
}
else
{
 digitalWrite(myLEDpin, LOW);
}

You’ll need to declare myLEDpin as the pin you intend to use, and include a pinMode declaration setting it as an OUTPUT pin.

This code won’t work as a simple drop-in solution, but it may help to point you in the right direction when you start to learn a bit more.

Pete.

2 Likes

@PeteKnight wow Pete you are giving him more detailed hints than you gave me :wink::rofl::joy::shushing_face:

2 Likes

:rofl::rofl::rofl::rofl:

1 Like