Help, how to do that?
Step by step Look at and play with examples to get experience with each of the 'components' lcd, wifi, firebase;.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project See About the Installation & Troubleshooting category.
You do know what the blindingly obvious problem is here, don't you?
Wouldn't it be nice if the forum admins would actually fix it?
I have a question, the lcd i2 20x4 won't display the data i fetch from lcd
here's my code:
/*
Rui Santos
Complete project details at our blog.
- ESP32: https://RandomNerdTutorials.com/esp32-firebase-realtime-database/
- ESP8266: https://RandomNerdTutorials.com/esp8266-nodemcu-firebase-realtime-database/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Based in the RTDB Basic Example by Firebase-ESP-Client library by mobizt
https://github.com/mobizt/Firebase-ESP-Client/blob/main/examples/RTDB/Basic/Basic.ino
*/
// Include Libraries
#include "Arduino.h"
#include "LiquidCrystal_PCF8574.h"
#include "Wire.h"
// Pin Definitions
#define LCD_ADDRESS 0x27
//#define LCD_ADDRESS 0x27
// Define LCD characteristics
#define LCD_ROWS 4
#define LCD_COLUMNS 20
#define SCROLL_DELAY 150
#define BACKLIGHT 255
// object initialization
LiquidCrystal_PCF8574 lcd20x4;
#include <Arduino.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
// Insert your network credentials
#define WIFI_SSID "Data Base_AP-2.4G"
#define WIFI_PASSWORD "password1234"
// Insert Firebase project API Key
#define API_KEY "AIzaSyAcXG9YqVLlQxuLox3d8MkBj22CqAHwSaM"
// Insert RTDB URLefine the RTDB URL */
#define DATABASE_URL "https://testing-123-6a032-default-rtdb.firebaseio.com/"
//Define Firebase Data object
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
unsigned long sendDataPrevMillis = 0;
int intValue;
float floatValue;
bool signupOK = false;
void setup() {
Serial1.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial1.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
Serial1.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
/* Assign the api key (required) */
config.api_key = API_KEY;
/* Assign the RTDB URL (required) */
config.database_url = DATABASE_URL;
/* Sign up */
if (Firebase.signUp(&config, &auth, "", "")) {
Serial.println("ok");
signupOK = true;
}
else {
Serial.printf("%s\n", config.signer.signupError.message.c_str());
}
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);
// initialize the lcd
lcd20x4.begin(LCD_COLUMNS, LCD_ROWS, LCD_ADDRESS, BACKLIGHT);
}
void loop() {
if (Firebase.ready() && signupOK && (millis() - sendDataPrevMillis > 15000 || sendDataPrevMillis == 0)) {
sendDataPrevMillis = millis();
if (Firebase.RTDB.getInt(&fbdo, "/test/int")) {
if (fbdo.dataType() == "int") {
intValue = fbdo.intData();
Serial.println(intValue);
lcd20x4.print(intValue);
}
}
else {
Serial.println(fbdo.errorReason());
lcd20x4.print(fbdo.errorReason());
}
if (Firebase.RTDB.getFloat(&fbdo, "/test/float")) {
if (fbdo.dataType() == "float") {
floatValue = fbdo.floatData();
Serial.println(floatValue);
lcd20x4.print(floatValue);
}
}
else {
Serial.println(fbdo.errorReason());
lcd20x4.print(fbdo.errorReason());
}
}
}
Start by leaving out all things that don't relate to the LCD and use the examples of the
LiquidCrystal_PCF8574 library to get that going based on the examples that come with the library.
To which pins of the Mega did you connect the LCD backpack? If the answer is "A4 and A5", it's wrong.
i follow the step below:
If that is your test setup for the display (nothing else connected), do the demo sketches that come with the library show expected data?
If not, have you tried adjusting the potentiometer?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.