/ Say_Their_Names_LEDMatrix / code.py
code.py
1 # SPDX-FileCopyrightText: 2020 Limor Fried for Adafruit Industries 2 # 3 # SPDX-License-Identifier: MIT 4 5 import time 6 import board 7 import displayio 8 import framebufferio 9 import rgbmatrix 10 import terminalio 11 import adafruit_display_text.label 12 13 names = [ 14 "Rodney King", 15 "Abner Louima", 16 "Amadou Diallo", 17 "Sean Bell", 18 "Oscar Grant", 19 "Eric Garner", 20 "Michael Brown", 21 "Laquan McDonald", 22 "Freddie Gray", 23 "Antwon Rose Jr", 24 "Ahmaud Arbery", 25 "Breonna Taylor", 26 "John Crawford III", 27 "Ezell Ford", 28 "Dante Parker", 29 "Michelle Cusseaux", 30 "Laquan Mcdonald", 31 "George Mann", 32 "Tanisha Anderson", 33 "Akai Gurley", 34 "Tamir Rice", 35 "Rumain Brisbon", 36 "Jerame Reid", 37 "Matthew Ajibade", 38 "Frank Smart", 39 "Nastasha McKenna", 40 "Tony Robinson", 41 "Anthony Hill", 42 "Mya Hall", 43 "Phillip White", 44 "Eric Harris", 45 "Walter Scott", 46 "William Chapman II", 47 "Alexia Christian", 48 "Brendon Glenn", 49 "Victor Maunel Larosa", 50 "Jonathan Sanders", 51 "Freddie Blue", 52 "Joseph Mann", 53 "Salvado Ellswood", 54 "Sanda Bland", 55 "Albert Joseph Davis", 56 "Darrius Stewart", 57 "Billy Ray Davis", 58 "Samuel Dubose", 59 "Michael Sabbie", 60 "Brian Keith Day", 61 "Christian Taylor", 62 "Troy Robinson", 63 "Asshams Pharoah Manley", 64 "Felix Kumi", 65 "Keith Harrison Mcleod", 66 "Junior Prosper", 67 "Lamontez Jones", 68 "Paterson Brown", 69 "Dominic Hutchinson", 70 "Anthony Ashford", 71 "Alonzo Smith", 72 "Tyree Crawford", 73 "India Kager", 74 "La'vante Biggs", 75 "Michael Lee Marshall", 76 "Jamar Clark", 77 "Richard Perkins", 78 "Nathaniel Harris Pickett", 79 "Benni Lee Tignor", 80 "Miguel Espinal", 81 "Michael Noel", 82 "Kevin Matthews", 83 "Bettie Jones", 84 "Quintonio Legrier", 85 "Keith Childress Jr", 86 "Janet Wilson", 87 "Randy Nelson", 88 "Antronie Scott", 89 "Wendell Celestine", 90 "David Joseph", 91 "Calin Roquemore", 92 "Dyzhawn Perkins", 93 "Christoper Davis", 94 "Marco Loud", 95 "Peter Gaines", 96 "Torry Robison", 97 "Darius Robinson", 98 "Kevin Hicks", 99 "Mary Truxillo", 100 "Demarcus Semer", 101 "Willie Tillman", 102 "Terrill Thomas", 103 "Sylville Smith", 104 "Sean Reed", 105 "Alton Streling", 106 "Philando Castile", 107 "Terence Crutcher", 108 "Paul O'Neal", 109 "Alteria Woods", 110 "Jordan Edwards", 111 "Aaron Bailey", 112 "Ronell Foster", 113 "Stephon Clark", 114 "Antwon Rose II", 115 "Botham Jean", 116 "Pamela Turner", 117 "Dominique Clayton", 118 "Atatiana Jefferson", 119 "Christopher Whitfield", 120 "Christopher Mccovey", 121 "Eric Reason", 122 "Michael Lorenzo Dean", 123 "Tony McDade", 124 "David McAtee", 125 "George Floyd", 126 ] 127 128 displayio.release_displays() 129 matrix = rgbmatrix.RGBMatrix( 130 width=64, 131 bit_depth=4, 132 rgb_pins=[board.D6, board.D5, board.D9, board.D11, board.D10, board.D12], 133 addr_pins=[board.A5, board.A4, board.A3, board.A2], 134 clock_pin=board.D13, 135 latch_pin=board.D0, 136 output_enable_pin=board.D1, 137 ) 138 display = framebufferio.FramebufferDisplay(matrix) 139 140 # Create a 3 line set of small font text 141 blm_font = [None, None, None] 142 for line in range(3): 143 label = adafruit_display_text.label.Label( 144 terminalio.FONT, color=0xFFFFFF, x=2, y=line * 10 + 5 145 ) 146 blm_font[line] = label 147 148 # Create a 2 line set of font text 149 names_font = [None, None] 150 for line in range(2): 151 label = adafruit_display_text.label.Label( 152 terminalio.FONT, 153 color=0xFFFFFF, 154 anchored_position=(32, line * 14) # these will center text when anchor is top-middle 155 ) 156 label.anchor_point = (0.5, 0) 157 names_font[line] = label 158 159 g = displayio.Group() 160 for line in blm_font: 161 g.append(line) 162 for line in names_font: 163 g.append(line) 164 display.show(g) 165 166 167 while True: 168 # show three small font lines in white 169 for line in blm_font: 170 line.color = 0xFFFFFF 171 # set up text 172 blm_font[0].text = "BLACK" 173 blm_font[1].text = "LIVES" 174 blm_font[2].text = "MATTER" 175 time.sleep(1) 176 177 blm_font[1].color = blm_font[2].color = 0 # hide lines 2&3 178 time.sleep(1) 179 blm_font[1].color = 0xFFFFFF # show middle line 180 blm_font[0].color = blm_font[2].color = 0 # hide lines 1&3 181 time.sleep(1) 182 blm_font[2].color = 0xFFFFFF # show last line 183 blm_font[0].color = blm_font[1].color = 0 # hide lines 1&2 184 time.sleep(1) 185 186 # hide the three small text lines 187 for line in blm_font: 188 line.color = 0 189 time.sleep(1) 190 191 for name in names: 192 # say their names! 193 print(name) 194 lines = name.split(" ") 195 names_font[0].text = lines[0] 196 names_font[1].text = lines[1] 197 time.sleep(5) 198 names_font[0].text = names_font[1].text = ""