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?

More than 3 years have passed since last update.

seeeduino xiao で circuit python 遊び 備忘録

Posted at

1.link

seeed xiao wiki
adafruit circuitpython ライブラリ

i2cアドレススキャン

>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
True
>>> print([hex(i) for i in i2c.scan()])
['0x3c', '0x51']

print文は内包表記
平で書くと

>>> for i in i2c.scan():
...     print(hex(i))
...
0x3c
0x51
v

標準モジュール確認

>>> help("modules")
__main__          digitalio         pulseio           supervisor
analogio          gc                pwmio             sys
array             math              random            time
board             microcontroller   rotaryio          touchio
builtins          micropython       rtc               usb_hid
busio             neopixel_write    storage           usb_midi
collections       os                struct
Plus any modules on the filesystem
>>>

2.拡張ボード

拡張ボードseeed shop

2-1.OLEDディスプレイ

xiaoのlibフォルダにadafruit_ssd1306.mpy、adafruit_framebuf.mpy、adafruit_bus_deviceを保存。
xiaoの直下フォルダにmain.py、font5x8.binを保存

main.pyは以下の通り

import board
import adafruit_ssd1306
import busio
i2c = busio.I2C(board.SCL,board.SDA)

display = adafruit_ssd1306.SSD1306_I2C(128,64,i2c)

display.fill(0)
display.text("hello world",0,0,1)
display.show()

原因不明だけどboard⇒busio⇒adafruit_ssd1306もしくはbusio⇒board⇒adafruit_ssd1306の順にimportすると動かない。謎。

display.pixel(0,0,1) #(x座標0-127 ,y座標0-31,0:黒 1:白)

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?