BeagleBoard drives LCD via I2C - step 2

The BeagleBoard can now drive an LCD display via I2C, using an Arduino as an I2C slave.

The Arduino sketch is a slightly tweaked merge of two examples: the LCD driver and the I2C slave.

I've written the BeagleBoard driver in Python. It's really simple.

It uses my generic I2C class, which is also very straightforward.

For now, here's the Python code for the LCD Driver.

#! /usr/bin/python
import i2c, time

FF = '\f' # Form Feed

class LCD:
 def __init__(self, address): 
  self.lcd = i2c.I2C_device(0x04)
  
 def pr(self, ch):
  self.lcd.begin_transmission()
  self.lcd.send(ord(ch))
  self.lcd.end_transmission()
  
 def prints(self, string):
  for ch in string:
   self.pr(ch)
   
 def clear(self):
  self.pr(FF)
   
lcd = LCD(4)
lcd.clear()
lcd.prints('Hi from BB')
time.sleep(2)
lcd.clear()
lcd.prints('Hello again')
It uses my generic I2C class, which is also very straightforward.

I'll put all the code up on GitHub real soon now.

Comments

  1. Hi Romilly,

    Can you post a link for your i2c class?

    Thanks,
    Eric

    ReplyDelete

Post a Comment

Popular posts from this blog

Controlling a Raspberry Pi Pico remotely using PySerial

Five steps to connect Jetson Nano and Arduino

Raspberry Pi Pico project 2 - MCP3008