コンテンツにスキップ

#210 GPIO I2C Brick

Overview

汎用I/O拡張チップを使用したBrickです。

I2Cで8個のLEDを制御できます。

接続

I2Cコネクタへ接続します。

Arduino

Raspberry Pi

PCAL6408 Datasheet

Document
PCAL6408 Datasheet

Register

Slave Address
0x20

回路図

Library

  • pipからインストール

1
$ sudo pip install FaBoGPIO_PCAL6408

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# coding: utf-8
import FaBoGPIO_PCAL6408
import time
import sys

pcal6408 = FaBoGPIO_PCAL6408.PCAL6408()

try:
    while True:
        for i in xrange(8):
            pcal6408.setDigital(1<<i, 1)
            time.sleep(1)

        pcal6408.setAllClear()
        time.sleep(1)

except KeyboardInterrupt:
    pcal6408.setAllClear()
    sys.exit()

構成Parts

  • NXP PCAL6408

GitHub

  • https://github.com/FaBoPlatform/FaBo/tree/master/210_gpio