#include <Arduino.h>
#include <LiquidCrystal_I2C.h>
#define LCD_ADDR 0x27 // Common I2C address (try 0x3F if not working)
#define LCD_COLS 16
#define LCD_ROWS 2
LiquidCrystal_I2C lcd(LCD_ADDR, LCD_COLS, LCD_ROWS);
// ─── FreeRTOS Task ───────────────────────────────────────────────
void lcdTask(void *pvParameters) {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Hello, World!");
lcd.setCursor(0, 1);
lcd.print("i am vinay");
for (;;) {
vTaskDelay(pdMS_TO_TICKS(1000)); // idle, LCD holds content
}
}
// ─── Setup ───────────────────────────────────────────────────────
void setup() {
Serial.begin(115200);
xTaskCreate(
lcdTask, // Task function
"LCD_Task", // Task name
4096, // Stack size (bytes)
NULL, // Parameters
1, // Priority
NULL // Task handle (not needed)
);
}
void loop() {
vTaskDelete(NULL); // Delete loop task, free resources
}