daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Copyright (c) 2014 Adafruit Industries
  2. # Author: Tony DiCola
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. # THE SOFTWARE.
  21.  
  22. import time
  23.  
  24. import Adafruit_GPIO.SPI as SPI
  25. import Adafruit_SSD1306
  26.  
  27. from PIL import Image
  28. from PIL import ImageDraw
  29. from PIL import ImageFont
  30.  
  31.  
  32. # Raspberry Pi pin configuration:
  33. RST = 24
  34. # Note the following are only used with SPI:
  35. DC = 23
  36. SPI_PORT = 0
  37. SPI_DEVICE = 0
  38.  
  39.  
  40. # 128x32 display with hardware I2C:
  41. disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
  42.  
  43. # Initialize library.
  44. disp.begin()
  45.  
  46. # Clear display.
  47. disp.clear()
  48. disp.display()
  49.  
  50. # Create blank image for drawing.
  51. # Make sure to create image with mode '1' for 1-bit color.
  52. width = disp.width
  53. height = disp.height
  54. image = Image.new('1', (width, height))
  55.  
  56. # Get drawing object to draw on image.
  57. draw = ImageDraw.Draw(image)
  58.  
  59. # Draw a black filled box to clear the image.
  60. draw.rectangle((0,0,width,height), outline=0, fill=0)
  61.  
  62. # Load default font.
  63. font = ImageFont.load_default()
  64.  
  65. draw.text((0,0), "Design 6 - Group 8", font=font, fill=255)
  66. draw.text((0, 20), "JS JT FH CT", font=font, fill=255)
  67.  
  68. # Display image.
  69. disp.image(image)
  70. disp.display()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top