Hi All,
How can i add a OLED to my project and have the values shown on the screen as well as the blynk app?
Im trying to modify my code to add one, but im too newbish and dont know what im doing.
Thanks in advance!
Hi All,
How can i add a OLED to my project and have the values shown on the screen as well as the blynk app?
Im trying to modify my code to add one, but im too newbish and dont know what im doing.
Thanks in advance!
There are tons of tutorials, we have a lot of stuff in docs as well.
Hello I would like to send the datalog on OLED instead of the serial port. How to modify the code?
like this datalog:
Blynk v.X.X.X
Your IP is 192.168.0.11
Connecting…
Blynk connected!
@victagayun take a look at the pictures below and then study the sketch.
/*
ESP8266_Standalone2OLED.ino by Costas 4 July 2016
OLED will indicate uptime but ALSO indicate if the Blynk app has been stopped for more than about 10s
See the 2 url's below to set up your OLED and replace XXXXX's in the sketch with your details
http://arduino-er.blogspot.com.cy/2016/04/hello-world-nodemcu-esp8266-128x64-i2c.html and
http://arduino-er.blogspot.com.cy/2016/04/nodemcu-esp8266-to-display-on-128x64.html
*/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET LED_BUILTIN //4
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
//#define BLYNK_PRINT Serial
#define BLYNK_PRINT display
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
SimpleTimer timer;
long starttime;
long appseconds;
bool isFirstConnect = true;
char auth[] = "xxxxxxxxxxxxxx";
void setup()
{
//Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setCursor(0,0);
display.setTextSize(1);
Blynk.begin(auth, "xxxxxxxxxxxxxxxxx");
display.display();
timer.setInterval(10000, uptime);
starttime = (millis() / 1000);
}
BLYNK_CONNECTED() {
if (isFirstConnect) {
Blynk.virtualWrite(V0, 0);
Blynk.virtualWrite(V1, 0);
isFirstConnect = false;
}
}
void uptime(){
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setCursor(0,0);
bool result = Blynk.connected();
if(result == true){
display.print("Connected for ");
display.print((millis() /1000) - starttime);
display.println("s");
BLYNK_LOG("Up secs is:\n %d", (millis() /1000) - starttime );
}
else{
display.println("Blynk disconnected");
starttime = (millis() / 1000); // reset start of uptime
}
display.display();
Blynk.syncVirtual(V1);
display.print(" App secs is ");
display.println(appseconds + 10);
display.display();
if((millis() / 1000) - starttime > (appseconds + 16)){
display.println(" WARNING:\n Blynk app stopped");
}
display.display();
}
BLYNK_READ(V0) // Value Display to check if Blynk App was stopped, set at 5s reading frequency
{ // READ function is actually for writing to pins
Blynk.virtualWrite(V0, (millis() /1000) - starttime);
Blynk.virtualWrite(V1, (millis() /1000) - starttime);
}
BLYNK_WRITE(V1) // Value Display to check if Blynk App was stopped, set at 5s reading frequency
{ // WRITE function is actually for reading pin values
appseconds = param.asDouble(); // when this was BLYNK_WRITE(V0) function
}
void loop()
{
Blynk.run();
timer.run();
}
Dears , would you plz help me…
When I enter this code ‘’ Blynk.begin(auth, ssid, pass); ‘’ , the display turns off.
This is while before I enter this statement, the code works correctly. Of course, Blynk does not work!!
I use the SPI OLED 0.96 and DHT11 in my code.
@yatechno I’d suggest that you start a new “need help with my project” topic and provide ALL of the information that is requested when you do this, along with details of the type of OLED display you are using and how it is connected to your board.
I’d also suggest including your serial monitor output, formatted with triple backticks in the same was as when you post code.
Pete.