0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

電子工作メモ - マトリクスLED

Last updated at Posted at 2024-03-21

マトリクスLED

種類

  • ピンアサイン

    • 左下から反時計回りに、1-16

      col pin 74HC595 row pin 74HC595
      1 13 Q0 15 1 9 Q0 15
      2 3 Q1 2 2 14 Q1 2
      3 4 Q2 3 3 8 Q2 3
      4 10 Q3 4 4 12 Q3 4
      5 6 Q4 5 5 1 Q4 5
      6 11 Q5 6 6 7 Q5 6
      7 15 Q6 7 7 2 Q6 7
      8 16 Q7 8 8 5 Q7 8
  • コモンアノード(キットのLEDはこっち)

    • 行: High
    • 列: Low
      • で点灯する
  • コモンカソード

    • 行: Low
    • 列: High
      • で点灯する
  • スマイルマーク

    col1 col2 col3 col4 col5 col6 col7 col8
    row1 0 0 0 0 0 0 0 0
    row2 0 0 1 1 1 1 0 0
    row3 0 1 0 0 0 0 1 0
    row4 1 0 1 0 0 1 0 1
    row5 1 0 0 0 0 0 0 1
    row6 1 0 0 1 1 0 0 1
    row7 0 1 0 0 0 0 1 0
    row8 0 0 1 1 1 1 0 0
    col Binary Hex
    1 0001 1100 0x1c
    2 0010 0010 0x22
    3 0101 0001 0x51
    4 0100 0101 0x45
    5 0100 0101 0x45
    6 0101 0001 0x51
    7 0010 0010 0x22
    8 0001 1100 0x1c

ソース

import time
from my74HC595 import Chip74HC595

smilingFace=[0x1C, 0x22, 0x51, 0x45, 0x45, 0x51, 0x22, 0x1C] #^_^#
numdata = [
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # " "
    0x00, 0x00, 0x3E, 0x41, 0x41, 0x3E, 0x00, 0x00, # "0"
    0x00, 0x00, 0x21, 0x7F, 0x01, 0x00, 0x00, 0x00, # "1"
    0x00, 0x00, 0x23, 0x45, 0x49, 0x31, 0x00, 0x00, # "2"
    0x00, 0x00, 0x22, 0x49, 0x49, 0x36, 0x00, 0x00, # "3"
    0x00, 0x00, 0x0E, 0x32, 0x7F, 0x02, 0x00, 0x00, # "4"
    0x00, 0x00, 0x79, 0x49, 0x49, 0x46, 0x00, 0x00, # "5"
    0x00, 0x00, 0x3E, 0x49, 0x49, 0x26, 0x00, 0x00, # "6"
    0x00, 0x00, 0x60, 0x47, 0x48, 0x70, 0x00, 0x00, # "7"
    0x00, 0x00, 0x36, 0x49, 0x49, 0x36, 0x00, 0x00, # "8"
    0x00, 0x00, 0x32, 0x49, 0x49, 0x3E, 0x00, 0x00, # "9"
    0x00, 0x00, 0x3F, 0x44, 0x44, 0x3F, 0x00, 0x00, # "A"
    0x00, 0x00, 0x7F, 0x49, 0x49, 0x36, 0x00, 0x00, # "B"
    0x00, 0x00, 0x3E, 0x41, 0x41, 0x22, 0x00, 0x00, # "C"
    0x00, 0x00, 0x7F, 0x41, 0x41, 0x3E, 0x00, 0x00, # "D"
    0x00, 0x00, 0x7F, 0x49, 0x49, 0x41, 0x00, 0x00, # "E"
    0x00, 0x00, 0x7F, 0x48, 0x48, 0x40, 0x00, 0x00, # "F"
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  # " "
]

chip = Chip74HC595(18, 20, 21, 19)
try:
    while True:
        #smilingFace
        for j in range(100):
            cols = 0x01
            for i in range(8):
                chip.disable()
                chip.shiftOut(1, smilingFace[i])
                chip.shiftOut(0, ~cols)
                cols <<= 1
                chip.enable()
                time.sleep_us(500)
        #numdata
        for i in range(136):
            for _ in range(5):
                cols = 0x01
                for j in range(i, 8+i):
                    chip.disable()
                    chip.shiftOut(1, numdata[j])
                    chip.shiftOut(0, ~cols)
                    cols <<= 1
                    chip.enable()
                    time.sleep_us(500)
except:
    pass
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?