paritoshnitc
paritoshnitc

Reputation: 11

i2c device not giving output when connecting to raspberry pi 4b

I am connecting i2c device (for displaying results) to raspberry pi 4b using GPIO pins all the connection is okay from raspberry pi to i2c display. and the address of i2c device i am putting correctly, but i am not getting the display on i2c device. while not running the device blue light comes out through i2c device but when i run the program which is suppose to give display at the device , the blue light goes off , kindly help, I on the i2c through raspi config

While running a test code

from luma.core.interface.serial import i2c
from luma.oled.device import ssd1306
from luma.core.render import canvas
from PIL import ImageFont


try:
    serial = i2c(port=1, address=0x27)  # or 0x3D
    device = ssd1306(serial)
    print("I2C device initialized successfully.")
except Exception as e:
    print(f"Failed to initialize I2C device: {e}")


def display_message():
    try:
        with canvas(device) as draw:
            draw.rectangle(device.bounding_box, outline="white", fill="black")
            draw.text((10, 10), "1", fill="white")
        print("Message displayed successfully.")
    except Exception as e:
        print(f"Failed to draw on display: {e}")


display_message()

its giving output that i2c device initialized successfully and message displayed succesfully , but there is nothing output on the i2c device , just it blinks sometimes

Upvotes: 0

Views: 82

Answers (0)

Related Questions