KRITSADA

Rpi3 LeafHat OLED Show Simple

Nov 24th, 2017
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import time
  2. import Adafruit_SSD1306
  3. from PIL import Image,ImageDraw,ImageFont
  4. disp = Adafruit_SSD1306.SSD1306_128_64(rst=1)
  5. disp.begin()
  6. disp.clear()
  7. count=0
  8. font = ImageFont.truetype('VCR_OSD_MONO_1.001.ttf',22)
  9. def show(x,y,st1,st2,st3):
  10.     image = Image.new('1',(128,64))
  11.     draw = ImageDraw.Draw(image)   
  12.     draw.text((x,y),str(st1),font=font, fill=1)
  13.     draw.text((x,y+20),str(st2),font=font, fill=1)
  14.     draw.text((x,y+40),str(st3),font=font, fill=1)
  15.     disp.image(image)
  16.     disp.display()
  17. while(1):
  18.     count=count+1
  19.     show(0,0,"KRITSADA","JAIYEN",str(count))
  20.     time.sleep(0.5)
Advertisement
Add Comment
Please, Sign In to add comment