Skip to content

Instantly share code, notes, and snippets.

@nezuppo
Last active May 11, 2023 13:56
Show Gist options
  • Save nezuppo/9b092b5e4b041c77ed593aa10e8339f6 to your computer and use it in GitHub Desktop.
Save nezuppo/9b092b5e4b041c77ed593aa10e8339f6 to your computer and use it in GitHub Desktop.
XIAO SAMD21 で CircuitPython で LED の点灯/消灯をやってみました
参考
https://wiki.seeedstudio.com/Seeeduino-XIAO-CircuitPython
http://zattouka.net/GarageHouse/micon/Arduino/XIAO/gaiyo.htm
CircuitPython のコンソールで以下実施
>>> import board
>>> from digitalio import DigitalInOut, Direction
>>> led = DigitalInOut(board.LED_INVERTED)
>>> led.direction = Direction.OUTPUT
XIAO オンボードのオレンジの LED が点灯しました。
LED を消灯
>>> led.value = True
LED を点灯
>>> led.value = False
>>> help(board)
object <module 'board'> is of type module
__name__ -- board
board_id -- seeeduino_xiao
A0 -- board.A0
A1 -- board.A1
A2 -- board.A2
A3 -- board.A3
A4 -- board.A4
A5 -- board.A5
A6 -- board.A6
A7 -- board.A7
A8 -- board.A8
A9 -- board.A9
A10 -- board.A10
D0 -- board.A0
D1 -- board.A1
D2 -- board.A2
D3 -- board.A3
D4 -- board.A4
D5 -- board.A5
D6 -- board.A6
D7 -- board.A7
D8 -- board.A8
D9 -- board.A9
D10 -- board.A10
TX -- board.A6
RX -- board.A7
MOSI -- board.A10
SCK -- board.A8
MISO -- board.A9
SCL -- board.A5
SDA -- board.A4
LED_INVERTED -- board.LED_INVERTED
YELLOW_LED_INVERTED -- board.LED_INVERTED
RX_LED_INVERTED -- board.RX_LED_INVERTED
BLUE_LED1_INVERTED -- board.RX_LED_INVERTED
TX_LED_INVERTED -- board.TX_LED_INVERTED
BLUE_LED2_INVERTED -- board.TX_LED_INVERTED
I2C -- <function>
SPI -- <function>
UART -- <function>
XIAO にはオンボードで二つの青色 LED もあり、
board.BLUE_LED1_INVERTED, board.BLUE_LED2_INVERTED が対応しているみたいです。
UART-RX通信の受信時、送信時に点灯するようですが、
board.LED_INVERTED 同様に Python で点灯/消灯させることができるっぽいです。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment