{"id":652,"date":"2019-04-19T11:10:18","date_gmt":"2019-04-19T02:10:18","guid":{"rendered":"https:\/\/ahnbk.com\/?p=652"},"modified":"2019-04-19T11:14:35","modified_gmt":"2019-04-19T02:14:35","slug":"setup-micropython-on-esp32-for-macos","status":"publish","type":"post","link":"https:\/\/ahnbk.com\/?p=652","title":{"rendered":"Setup MicroPython on ESP32 (for macOS)"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img data-attachment-id=\"657\" data-permalink=\"https:\/\/ahnbk.com\/?attachment_id=657\" data-orig-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/3405-06.jpg?fit=970%2C728&amp;ssl=1\" data-orig-size=\"970,728\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"3405-06\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/3405-06.jpg?fit=970%2C728&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/3405-06.jpg?fit=525%2C394&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/3405-06.jpg?resize=180%2C135&#038;ssl=1\" alt=\"\" class=\"wp-image-657\" width=\"180\" height=\"135\" srcset=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/3405-06.jpg?w=970&amp;ssl=1 970w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/3405-06.jpg?resize=768%2C576&amp;ssl=1 768w\" sizes=\"(max-width: 180px) 100vw, 180px\" data-recalc-dims=\"1\" \/><\/figure><\/div>\n\n\n\n<ul><li>\uc0ac\uc6a9\ubcf4\ub4dc: Adafruit HUZZAH32 \u2013 ESP32 Feather Board<\/li><li>\ucc38\uace0\ub9c1\ud06c: <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/pvanallen\/esp32-getstarted\/blob\/master\/docs\/setup.md\" target=\"_blank\">https:\/\/github.com\/pvanallen\/esp32-getstarted\/blob\/master\/docs\/setup.md<\/a><\/li><\/ul>\n\n\n\n<p>CP210x \ub4dc\ub77c\uc774\ubc84 \uc124\uce58 (<a rel=\"noreferrer noopener\" aria-label=\"https:\/\/www.silabs.com\/products\/development-tools\/software\/usb-to-uart-bridge-vcp-drivers (opens in a new tab)\" href=\"https:\/\/www.silabs.com\/products\/development-tools\/software\/usb-to-uart-bridge-vcp-drivers\" target=\"_blank\">https:\/\/www.silabs.com\/products\/development-tools\/software\/usb-to-uart-bridge-vcp-drivers<\/a>)<\/p>\n\n\n\n<p>esptool \uc124\uce58 (pip3\uac00 \uc5c6\ub294 \uacbd\uc6b0, homebrew\ub97c \uc774\uc6a9\ud574 \uc124\uce58\ud55c\ub2e4)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip3 install esptool<\/code><\/pre>\n\n\n\n<p>\ubcf4\ub4dc\ub97c \uc5f0\uacb0\ud558\uace0, \uae30\uc874 flash \ubaa8\ub450 \ucd08\uae30\ud654<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ esptool.py --chip esp32 -p \/dev\/tty.SLAB_USBtoUART erase_flash\n\nesptool.py v2.6\nSerial port \/dev\/tty.SLAB_USBtoUART\nConnecting........__\nChip is ESP32D0WDQ6 (revision 1)\nFeatures: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None\nMAC: 84:0d:8e:0c:c9:f0\nUploading stub...\nRunning stub...\nStub running...\nErasing flash (this may take a while)...\nChip erase completed successfully in 2.9s\nHard resetting via RTS pin...<\/code><\/pre>\n\n\n\n<p>\ud38c\uc6e8\uc5b4 \ub2e4\uc6b4\ub85c\ub4dc (<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/micropython.org\/download\/#esp32\" target=\"_blank\">https:\/\/micropython.org\/download\/#esp32<\/a>)<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img data-attachment-id=\"653\" data-permalink=\"https:\/\/ahnbk.com\/?attachment_id=653\" data-orig-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.png?fit=708%2C288&amp;ssl=1\" data-orig-size=\"708,288\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-15\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.png?fit=708%2C288&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.png?fit=525%2C214&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.png?resize=291%2C117&#038;ssl=1\" alt=\"\" class=\"wp-image-653\" width=\"291\" height=\"117\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>\ud38c\uc6e8\uc5b4\ub97c \ubcf4\ub4dc\uc5d0 Flash \ud55c\ub2e4.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ esptool.py --chip esp32 -p \/dev\/tty.SLAB_USBtoUART write_flash -z 0x1000 esp32-bluetooth.bin\n\nesptool.py v2.6\nSerial port \/dev\/tty.SLAB_USBtoUART\nConnecting.....\nChip is ESP32D0WDQ6 (revision 1)\nFeatures: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None\nMAC: 84:0d:8e:0c:c9:f0\nUploading stub...\nRunning stub...\nStub running...\nConfiguring flash size...\nAuto-detected Flash size: 4MB\nCompressed 1549888 bytes to 970594...\nWrote 1549888 bytes (970594 compressed) at 0x00001000 in 85.5 seconds (effective 145.0 kbit\/s)...\nHash of data verified.\n\nLeaving...\nHard resetting via RTS pin...<\/code><\/pre>\n\n\n\n<p>\ubcf4\ub4dc\uc758 \uc804\uc6d0\uc744 \uaed0\ub2e4\uac00 \ub2e4\uc2dc \uc778\uac00\ud558\uace0, \ud130\ubbf8\ub110\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 \uc785\ub825\ud558\uc5ec REPL \ud658\uacbd\uc73c\ub85c \uc9c4\uc785.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ screen \/dev\/tty.SLAB_USBtoUART 115200<\/code><\/pre>\n\n\n\n<p>\ucc98\uc74c\uc5d4 \uc544\ubb34\ub7f0 \ub0b4\uc6a9\uc774 \ub098\ud0c0\ub098\uc9c0 \uc54a\uc9c0\ub9cc, \uba85\ub839\uc5b4\ub97c \uc785\ub825\ud558\uba74 \ub428. \ud3c9\uc18c \uc0ac\uc6a9\ud55c REPL \ud658\uacbd\uc640 \ub3d9\uc77c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>>>> print(\"hello\")\nhello\n>>> <\/code><\/pre>\n\n\n\n<p>REPL \ud658\uacbd\uc5d0\uc11c \ub098\uc624\ub824\uba74, ctrl + a, ctrl + \\ \ud0a4\ub97c \uc21c\uc11c\ub300\ub85c \ub204\ub974\uace0, \ud654\uba74 \ubc11 \ud504\ub86c\ud504\ud2b8\uac00 \ub098\uc624\uba74 y\ub97c \ub20c\ub7ec \uc885\ub8cc \uac00\ub2a5.<\/p>\n\n\n\n<p>Adafruit\uc5d0\uc11c \uc81c\uacf5\ud558\ub294 Micro Python Tool\uc744 \uc774\uc6a9\ud574 \ubcf4\ub4dc \ub0b4\ubd80\uc758 \ud30c\uc77c \uc2dc\uc2a4\ud15c\uc5d0 \ud30c\uc77c\uc744 \ub123\uac70\ub098 \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc2e4\ud589\ud560 \uc218 \uc788\uc74c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pip3 install adafruit-ampy<\/code><\/pre>\n\n\n\n<p>\ubcf4\ub4dc \ub0b4\ubd80 \ud30c\uc77c \uc2dc\uc2a4\ud15c\uc5d0 \uc788\ub294 \ud30c\uc77c\ub4e4 \ud45c\uc2dc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ampy -p \/dev\/tty.SLAB_USBtoUART ls\n\n\/boot.py<\/code><\/pre>\n\n\n\n<p>\ub2e4\uc74c\uc758 \uba85\ub839\uc5b4\ub97c \uc774\uc6a9\ud574 \ud30c\uc77c\ub4e4 \uc870\uc791 \uac00\ub2a5.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ampy\nUsage: ampy [OPTIONS] COMMAND [ARGS]...\n\n  ampy - Adafruit MicroPython Tool\n\n  Ampy is a tool to control MicroPython boards over a serial connection.\n  Using ampy you can manipulate files on the board's internal filesystem and\n  even run scripts.\n\nOptions:\n  -p, --port PORT    Name of serial port for connected board.  Can optionally\n                     specify with AMPY_PORT environment variable.  [required]\n  -b, --baud BAUD    Baud rate for the serial connection (default 115200).\n                     Can optionally specify with AMPY_BAUD environment\n                     variable.\n  -d, --delay DELAY  Delay in seconds before entering RAW MODE (default 0).\n                     Can optionally specify with AMPY_DELAY environment\n                     variable.\n  --version          Show the version and exit.\n  --help             Show this message and exit.\n\nCommands:\n  get    Retrieve a file from the board.\n  ls     List contents of a directory on the board.\n  mkdir  Create a directory on the board.\n  put    Put a file or folder and its contents on the board.\n  reset  Perform soft reset\/reboot of the board.\n  rm     Remove a file from the board.\n  rmdir  Forcefully remove a folder and all its children from the board.\n  run    Run a script and print its output.<\/code><\/pre>\n\n\n\n<p>\ubcf4\ub4dc\uc5d0 \uc788\ub294 LED\ub85c GPIO \ud14c\uc2a4\ud2b8. 13\ubc88 \ud540\uc5d0 \uc5f0\uacb0\ub418\uc5b4 \uc788\uc74c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>>>> import machine\n>>> led = machine.Pin(13, machine.Pin.OUT)\n>>> led.value(1)\n>>> led.value(0)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img data-attachment-id=\"654\" data-permalink=\"https:\/\/ahnbk.com\/?attachment_id=654\" data-orig-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?fit=4032%2C3024&amp;ssl=1\" data-orig-size=\"4032,3024\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;1.8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone X&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1555672064&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4&quot;,&quot;iso&quot;:&quot;80&quot;,&quot;shutter_speed&quot;:&quot;0.125&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"image-15\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?fit=1000%2C750&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?fit=525%2C394&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?resize=282%2C212&#038;ssl=1\" alt=\"\" class=\"wp-image-654\" width=\"282\" height=\"212\" srcset=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?resize=2000%2C1500&amp;ssl=1 2000w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?resize=1000%2C750&amp;ssl=1 1000w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?resize=768%2C576&amp;ssl=1 768w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?w=1050&amp;ssl=1 1050w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-15.jpeg?w=1575&amp;ssl=1 1575w\" sizes=\"(max-width: 282px) 100vw, 282px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img data-attachment-id=\"655\" data-permalink=\"https:\/\/ahnbk.com\/?attachment_id=655\" data-orig-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?fit=4032%2C3024&amp;ssl=1\" data-orig-size=\"4032,3024\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;1.8&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;iPhone X&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1555672072&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4&quot;,&quot;iso&quot;:&quot;125&quot;,&quot;shutter_speed&quot;:&quot;0.25&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"image-16\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?fit=1000%2C750&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?fit=525%2C394&amp;ssl=1\" decoding=\"async\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?resize=282%2C212&#038;ssl=1\" alt=\"\" class=\"wp-image-655\" width=\"282\" height=\"212\" srcset=\"https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?resize=2000%2C1500&amp;ssl=1 2000w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?resize=1000%2C750&amp;ssl=1 1000w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?resize=768%2C576&amp;ssl=1 768w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?w=1050&amp;ssl=1 1050w, https:\/\/i0.wp.com\/ahnbk.com\/wp-content\/uploads\/2019\/04\/image-16.jpeg?w=1575&amp;ssl=1 1575w\" sizes=\"(max-width: 282px) 100vw, 282px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>\uc77c\ub2e8\uc740 \uc5ec\uae30\uae4c\uc9c0.<\/p>\n\n\n\n<p>\ucc38\uace0\ub9c1\ud06c: <a href=\"https:\/\/github.com\/pvanallen\/esp32-getstarted\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"https:\/\/github.com\/pvanallen\/esp32-getstarted (opens in a new tab)\">https:\/\/github.com\/pvanallen\/esp32-getstarted<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc0ac\uc6a9\ubcf4\ub4dc: Adafruit HUZZAH32 \u2013 ESP32 Feather Board \ucc38\uace0\ub9c1\ud06c: https:\/\/github.com\/pvanallen\/esp32-getstarted\/blob\/master\/docs\/setup.md CP210x \ub4dc\ub77c\uc774\ubc84 \uc124\uce58 (https:\/\/www.silabs.com\/products\/development-tools\/software\/usb-to-uart-bridge-vcp-drivers) esptool \uc124\uce58 (pip3\uac00 \uc5c6\ub294 \uacbd\uc6b0, homebrew\ub97c \uc774\uc6a9\ud574 \uc124\uce58\ud55c\ub2e4) \ubcf4\ub4dc\ub97c \uc5f0\uacb0\ud558\uace0, \uae30\uc874 flash \ubaa8\ub450 \ucd08\uae30\ud654 \ud38c\uc6e8\uc5b4 \ub2e4\uc6b4\ub85c\ub4dc (https:\/\/micropython.org\/download\/#esp32) \ud38c\uc6e8\uc5b4\ub97c \ubcf4\ub4dc\uc5d0 Flash \ud55c\ub2e4. \ubcf4\ub4dc\uc758 \uc804\uc6d0\uc744 \uaed0\ub2e4\uac00 \ub2e4\uc2dc \uc778\uac00\ud558\uace0, \ud130\ubbf8\ub110\uc5d0\uc11c \ub2e4\uc74c\uacfc \uac19\uc774 \uc785\ub825\ud558\uc5ec REPL \ud658\uacbd\uc73c\ub85c \uc9c4\uc785. \ucc98\uc74c\uc5d4 \uc544\ubb34\ub7f0 \ub0b4\uc6a9\uc774 \ub098\ud0c0\ub098\uc9c0 \uc54a\uc9c0\ub9cc, \uba85\ub839\uc5b4\ub97c \uc785\ub825\ud558\uba74 \ub428. \ud3c9\uc18c &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ahnbk.com\/?p=652\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Setup MicroPython on ESP32 (for macOS)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[133],"tags":[136,135,53,134],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXSW-aw","jetpack-related-posts":[],"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/652"}],"collection":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=652"}],"version-history":[{"count":2,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/652\/revisions"}],"predecessor-version":[{"id":658,"href":"https:\/\/ahnbk.com\/index.php?rest_route=\/wp\/v2\/posts\/652\/revisions\/658"}],"wp:attachment":[{"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahnbk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}