Android "device wasn't online yet"

Dear all

First here is my details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield

Wemos D1 mini with Wifi. Wemos conneted wifi thru smartphone hotspot tethering.
• Smartphone OS (iOS or Android) + version
Android 7.0
• Blynk server or local server
Server: Blynk Cloud
• Blynk Library version
Ver: 2.21.0
• 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.


#include <Adafruit_Sensor.h>
#define BLYNK_PRINT Serial  // you can comment out, its for terminal window only
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
#include <Wire.h>
#include <SFE_MicroOLED.h>

#define DHTPIN D8                                           // port where DTH22 is connected (D4 is IO2 on wemos D1 mini)
#define DHTTYPE DHT11                                       // I use DHT22, change to other DHT senzor if you use other one
DHT dht(DHTPIN, DHTTYPE);                                   // enabled DHT sensor

char auth[] = "26f52fe8ef7xxxxxxx3fb16e32f8c2";                       // Your Blynk authentication string

char ssid[] = "Ldx";                                       // SSID (name) of your wifi
char pass[] = "apaya1234";                                   // your wifi password

SimpleTimer timer;                                          // enable simple timer

#define PIN_RESET 255                                       // Code for OLED inicialization
#define DC_JUMPER 0
MicroOLED oled(PIN_RESET, DC_JUMPER);  

void setup()
{
  Serial.begin(9600);                                       // Enabled serial debugging output
  Blynk.begin(auth, ssid, pass);                            // Connects to wifi and Blynk services

  oled.begin();                                             // start oled display
  oled.clear(PAGE);                                         // clears oled cash
  oled.clear(ALL);
  oled.setFontType(0);                                      // set small font
  oled.setCursor(0,40);                                     // set pen coordinates
  oled.print("bronka");                                     // puts name of senzor/room at the bottom of display to cache
  oled.display();                                           // display whats in cache
  
  timer.setInterval(1000L, sendTemperature);               // every 1 seconds run function sendTemperature

  
  
}

void sendTemperature()                                      // function send temperature
{
  float h = dht.readHumidity();                             // reads humidity from senzor and save to h
  float t = dht.readTemperature();                          // reads temperature from senzor and save to t
  
  if (isnan(h) or isnan(t)) {                               // checks if readings from sensors were obtained
    // cant read sensor
  }
  else {
  Blynk.virtualWrite(V4, t);                                 // send to Blynk virtual pin 1 temperature value
  Blynk.virtualWrite(V5, h);                                 // send to Blynk virtual pin 3 humidity value
  oled.setFontType(2);                                      // set big font type 2
  oled.setCursor(0,0);                                      // set pen coordinates fot temperature readings
  oled.print(t);                                            // puts puts temperature value to display cache
  oled.setCursor(0,21);                                     // set pen coordinates fot humidity readings
  oled.print(h);                                            // puts puts humidity value to display cache
  oled.display();                                           // display whats in cache
  }  
}

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

void loop()

I found no issue to verify the sketch and upload to Wemos D1 mini but i have a problem on:

  1. OLED can’t show anything.
  2. On my smartphone always show “device wasn’t online yet”.

Thanks,

I edited your post to block your auth code from public viewing… but you might want to refresh it anyhow… else others may start messing with your stuffs :stuck_out_tongue_winking_eye:

Try looking at the serial monitor output… maybe add DEBUG for more info. Also go through the troubleshooting options…

Typo?? you only need one void loop() :stuck_out_tongue_winking_eye:

Hi Gunner,

Thanks to block my auth code.
The last “void loop()” is typo.

Well after i add DEBUG prints then serial monitor come out as below:

[6977] Connecting to blynk-cloud.com:80
[7103] <[02|00|01|00] 3262d
[12105] Connecting to blynk-cloud.com:80
[12170] <[02|00|01|00] 3262
[17171] Connecting to blynk-cloud.com:80

It seems connection problem with Blynk-cloud.

Can you PING blynk-cloud.com from your PC? If so, try using the resulting IP address in your code like this…

Blynk.begin(auth, ssid, pass, "xxx.xxx.xxx.xxx", 80);

I add ip address on Blynk.begin(auth, ssid, pass, “xxx.xxx.xxx.xxx”, 80);
unfortunately in serial monitor always Connecting to Blynk.begin(auth, ssid, pass, “xxx.xxx.xxx.xxx”, 80);

Trying many times to restart my android and re-install Blynk apps but it still have same problem.
Something wrong with my smartphone?

If this is actually what your serial monitor says… then something is terribly wrong with your code :stuck_out_tongue:

What was the IP address you got from the PING?

Sir Gunner thank you so much now I can connect it. but in app blynk its offline.

post your current code, along with what the serial monitor is outputting, and we will see if we can get you pointed in the right direction.

I do follow your suggestion about how to connect boards by see in serial monitor and use debug after I take “Blynk.begin(auth,ssid,pass, “10.60.17.42”,8080);” this board can connect with wifi but in app blynk it doesn’t connect.

Your sincerely.

I use different auth token but same uid,pass wifi and the code same too.

And I change iP address to 192.168.43.151 It still doesn’t work on app blynk.

1 Like

I doubt very much if this is the IP address you get when you ping blynk-cloud.com

Are you using your own Blynk server? If so, what’s its IP address, and what DDNS and port forwarding have you put in place?

Pete.

1 Like

after i try to connect different internet 2 board it works well .After i take 2 board in the same internet its can both online on app blynks and it can Connecting to blynk-cloud.com:80 both but board 2 it doesn’t work in code but it still connect in app

1 Like

After I try connect 2 board to computer and upload code on 2 board in the same internet it can work well.then I change power supply(from computer to adapter) one board doesn’t work and doesn’t connect internet but another board can work well.I think cause from port USB when I connect board both with adapter the number port must be same.Perhaps it makes my another board doesn’t work.

1 Like