{"id":1657,"date":"2021-05-05T11:36:57","date_gmt":"2021-05-05T02:36:57","guid":{"rendered":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1657"},"modified":"2021-05-05T11:36:57","modified_gmt":"2021-05-05T02:36:57","slug":"raspberry-pi-pico-ssd1306-circuitpython","status":"publish","type":"post","link":"https:\/\/www.rocher.kyoto.jp\/arbr\/?p=1657","title":{"rendered":"Raspberry Pi Pico + SSD1306 + CircuitPython"},"content":{"rendered":"\n<p>\u8868\u984c\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u30cf\u30de\u3063\u305f\u306e\u3067\u30e1\u30e2<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u74b0\u5883<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Raspberry Pi Pico<\/li><li>CircuitPython(adafruit-circuitpython-raspberry_pi_pico-en_GB-6.2.0.uf2)<\/li><li>SSD1306\u30c9\u30e9\u30a4\u30d0\u30fc\u306eOLED(128*32)<\/li><li>\u30e9\u30a4\u30d6\u30e9\u30ea(adafruit-circuitpython-bundle-6.x-mpy-20210430)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u52d5\u3044\u305f\u30e9\u30a4\u30d6\u30e9\u30ea<\/h2>\n\n\n\n<p>adafruit_displayio_ssd1306.mpy\u4ed6\uff08adafruit_scd_30.mpy\u306f\u30bb\u30f3\u30b5\u30fc\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u4e0d\u8981\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/develop\/scd30_pico\/lib$ ls\nadafruit_bus_device    adafruit_displayio_ssd1306.mpy  adafruit_scd30.mpy\nadafruit_display_text  adafruit_framebuf.mpy\n<\/code><\/pre>\n\n\n\n<p>\u30b3\u30fc\u30c9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># SPDX-FileCopyrightText: 2020 by Bryan Siepert, written for Adafruit Industries\n#\n# SPDX-License-Identifier: Unlicense\nimport time\nimport board\nimport busio\nimport displayio\nimport terminalio\nfrom adafruit_display_text import label\nimport adafruit_displayio_ssd1306\n\nimport adafruit_scd30\n\ndisplayio.release_displays()\n\ni2c_oled = busio.I2C(scl=board.GP19, sda=board.GP18)\ndisplay_bus = displayio.I2CDisplay(i2c_oled, device_address=0x3C)\ndisplay = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)\n\nscd = adafruit_scd30.SCD30(i2c_oled)\n\ntry:\n    while True:\n        CO2 = scd.CO2\n        print(CO2)\n        text_group = displayio.Group(max_size=10)\n\n        # Draw a label\n        text = str(CO2)\n        text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF, x=0, y=4)\n        text_group.append(text_area)\n        display.show(text_group)\n\n        time.sleep(2)\nexcept Exception as e:\n    print(type(e))\n    print(e.args)\n    print(e)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u52d5\u304b\u306a\u304b\u3063\u305f\u30e9\u30a4\u30d6\u30e9\u30ea<\/h2>\n\n\n\n<p>adafruit_ssd1306<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8b\u8c61<\/h2>\n\n\n\n<p>\u521d\u671f\u5316\u3059\u308b\u3068\u3001PC\u306bUSB\u3068\u3057\u3066\u8a8d\u8b58\u3055\u308c\u306a\u304f\u306a\u308b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>i2c = busio.I2C(board.GP21, board.GP20)\ndisplay = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8a18\u3067\u4e0b\u306e\u611f\u3058<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;4936305.202012] usb 2-2: new full-speed USB device number 74 using xhci_hcd\n&#91;4936305.202193] usb 2-2: Device not responding to setup address.\n&#91;4936305.410209] usb 2-2: Device not responding to setup address.\n&#91;4936305.618018] usb 2-2: device not accepting address 74, error -71\n&#91;4936305.746021] usb 2-2: new full-speed USB device number 75 using xhci_hcd\n&#91;4936305.746221] usb 2-2: Device not responding to setup address.\n&#91;4936305.954217] usb 2-2: Device not responding to setup address.\n&#91;4936306.162031] usb 2-2: device not accepting address 75, error -71\n&#91;4936306.162095] usb usb2-port2: unable to enumerate USB device\n<\/code><\/pre>\n\n\n\n<p>\u30d0\u30b0\u306a\u306e\u304b\u4f7f\u3044\u65b9\u304b\u4e0d\u660e\u3002\u307e\u3060issue\u306e\u6d41\u308c\u304c\u65e9\u3059\u304e\u3066\u898b\u308b\u306e\u8ae6\u3081\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8868\u984c\u306e\u7d44\u307f\u5408\u308f\u305b\u3067\u30cf\u30de\u3063\u305f\u306e\u3067\u30e1\u30e2 \u74b0\u5883 Raspberry Pi Pico CircuitPython(adafruit-circuitpython-raspberry_pi_pico-en_GB-6.2.0.uf2) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[113,117],"tags":[],"class_list":["post-1657","post","type-post","status-publish","format-standard","hentry","category-python","category-117"],"_links":{"self":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1657"}],"version-history":[{"count":2,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1657\/revisions"}],"predecessor-version":[{"id":1659,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=\/wp\/v2\/posts\/1657\/revisions\/1659"}],"wp:attachment":[{"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocher.kyoto.jp\/arbr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}