Help connect the LCD display with Blynk

The connecting display on the I2C bus to Arduino (A4, A5), while nothing appears on the display. Sketch I add, also by an experimental way it was found out that without the command “Blynk.begin (auth)” the data on the display are displayed. I would be grateful if someone tells me what I’m doing wrong))).

#include <Adafruit_Sensor.h>
#define BLYNK_PRINT Serial    
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <DHT.h>

char auth[] = "ca59e6a7a9e64dd8900c27f038289174";

#define DHTPIN 2          
LiquidCrystal_I2C lcd(0x27,20,4);

#define DHTTYPE DHT11     
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

void sendSensor()
{
  float h = dht.readHumidity();


  if (isnan(h)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Blynk.virtualWrite(V5, h);
  
}

void setup()
{  
  lcd.init();
  lcd.backlight();
  dht.begin();
  
  Serial.begin(9600);
  Blynk.begin(auth); // If this command comment, then the data on the display are displayed
  
  timer.setInterval(1000L, sendSensor);
}

  void loop() {

  delay(500);
 
  float h = dht.readHumidity();
  
 
  lcd.setCursor(5,1);
  lcd.print(h);
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}
}

Duplicate the format in PUSH DATA example of just 2 lines of code in loop().

Hi, I’m just not a very smart student. I would like to ask for help if you are not hard, can I write a sketch because I’m still a beginner in this topic?

Can you help me?

Sure, look at each part of PUSH DATA and work out what it does, then replicate the same principles for your project.

Then spend lots and lots of time practising and studying the very comprehensive docs for Blynk.

Could you write me code if you are a professional?

You are using Ethernet, right?

Provide link for Ethernet adaptor and which Arduino are you using?

You should start by posting your code correctly:
Blynk - FTFC

This isn’t the place to come if you want someone to write your code for you. We’ll be happy to provide feedback and point you in the right direction, if you make the effort to understand the code that you’ve picked-up off of the internet.

In your particular case, I’d imagine that the problem Is to do with this:

Pin A4 on the Arduino is used to select the SD card on the combined Ethernet/SD card shield. The SD card and the Ethernet interface can’t be active at the same time.
I’d guess that when the Ethernet card is active (which it needs to be ALL of the time with a standard Blynk sketch) the LCD can’t be used.

A bit of internet research may reveal a solution, provided it doesn’t involve temporarily disabling the Ethernet shield via GPIO pin 10 while you write data to the LCD, as this will cause Blynk to disconnect.

Maybe there are libraries that allow different GPIO pins to be used for I2C.

Pete.

No, it’s a bluetooth module HC-06

No, it’s a bluetooth module HC-06

Is the HC-06 up and running with Blynk?

Paste your HC-06 Blynk sketch but be sure to format it for forum posts with backticks.

In that case, you’re using totally the wrong code. It should look more like this:
https://examples.blynk.cc/?board=Arduino%20Uno&shield=HC05%20or%20HC06&example=More%2FSync%2FSyncPhysicalButton

Because you’re currently telling the code to use Ethernet rather than Bluetooth:

the program will be halting at the point when it tries to connect to Blynk.

Pete.

1 Like