0
1

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.

M5Stack ATOM Matrix + UiFLOWでI2C

Posted at

M5Stack ATOM Matrix + UiFLOW(つまり,MicroPython)でI2Cを扱うにはどうするか,なかなかわからなかった。Blocklyでも動く(import i2c_busという方式)のだが,Writeできるのは1/2/4バイトの整数1個だけのようだ。
結論,MicroPythonの Quick reference for the ESP32 というページでわかった。

i2c = I2C(scl=Pin(21), sda=Pin(25), freq=100000)
i2c.writeto(slave_addr, buf)
i2c.readfrom(slave_addr, 4)

といったコードだ。

ところで,UiFlow(M5FLOW?)でSaveしてもSaveされるのはBlocklyだけで,手で書いたPythonコードはSaveされないことが判明。ええ?エディタに Copy & Paste してコードとして保存。

0
1
1

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?