#include <Wire.h> #include <LiquidCrystalI2C.h> LiquidCrystalI2C lcd(0x27, 16, 2); //…
- User
#include <Wire.h> #include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Adjust the I2C address if needed
void displayMessage() { lcd.clear();
// Display "ECOROOTS" centered on the first row lcd.setCursor((16 - 8) / 2, 0); // (16 - 8)/2 centers "ECOROOTS" (8 chars) on a 16-char display lcd.print("ECOROOTS");
// Scroll "ROOTING SUSTAINABILITY INTO THE FUTURE" on the second row String message = "ROOTING SUSTAINABILITY INTO THE FUTURE "; for (int pos = 0; pos < message.length() - 16; pos++) { lcd.setCursor(0, 1); lcd.print(message.substring(pos, pos + 16)); // Display 16 characters at a time delay(200); // Adjust speed as needed } delay(3000); // Hold the screen for 3 seconds after scrolling }
void setup() { lcd.init(); lcd.backlight(); displayMessage(); // Call the function once in setup }
void loop() { // Empty loop }
Create a new function for the arduino code that will display the following text on the LCD I2C Screen:
Searching the Environment for Devices
Make sure it is dispalyed for 5 seconds, and while the 5 seconds, it scrools from left to right, as with the function in the code above. remember that the functino must be called in the void setup after the ffirst fucntion
- Assistant