RED HAT
RED HAT
DIIDevHeads IoT Integration Server
Created by Boss lady on 8/5/2024 in #firmware-and-baremetal
Setting Up HC-SR04 Ultrasonic Sensor and 16x2 LCD on BeagleBone Black
@Boss lady make sure there is enough delay during the initialization process. LCD's sometimes need a bit more time to initialize properly. Try adding a delay before writing to the LCD:
import Adafruit_BBIO.GPIO as GPIO
from RPLCD.gpio import CharLCD
import time

LCD_RS = "P8_11"
LCD_E = "P8_12"
LCD_D4 = "P8_13"
LCD_D5 = "P8_14"
LCD_D6 = "P8_15"
LCD_D7 = "P8_16"

lcd = CharLCD(pin_rs=LCD_RS, pin_e=LCD_E, pins_data=[LCD_D4, LCD_D5, LCD_D6, LCD_D7], numbering_mode=GPIO.BOARD)

time.sleep(1)
lcd.clear()
lcd.write_string("Hello, World!")
time.sleep(5)
lcd.clear()
import Adafruit_BBIO.GPIO as GPIO
from RPLCD.gpio import CharLCD
import time

LCD_RS = "P8_11"
LCD_E = "P8_12"
LCD_D4 = "P8_13"
LCD_D5 = "P8_14"
LCD_D6 = "P8_15"
LCD_D7 = "P8_16"

lcd = CharLCD(pin_rs=LCD_RS, pin_e=LCD_E, pins_data=[LCD_D4, LCD_D5, LCD_D6, LCD_D7], numbering_mode=GPIO.BOARD)

time.sleep(1)
lcd.clear()
lcd.write_string("Hello, World!")
time.sleep(5)
lcd.clear()
12 replies