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. 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:
- OLED can’t show anything.
- On my smartphone always show “device wasn’t online yet”.
Thanks,