{"id":306,"date":"2021-02-21T16:40:50","date_gmt":"2021-02-21T07:40:50","guid":{"rendered":"https:\/\/sakae-shokai.com\/?p=306"},"modified":"2021-02-21T19:54:56","modified_gmt":"2021-02-21T10:54:56","slug":"esp32-%e3%83%8d%e3%83%83%e3%83%88%e3%83%af%e3%83%bc%e3%82%af%e6%8e%a5%e7%b6%9a","status":"publish","type":"post","link":"https:\/\/sakae-shokai.com\/wordpress\/?p=306","title":{"rendered":"ESP32 \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u63a5\u7d9a"},"content":{"rendered":"\n<p>\u4eca\u56de\u306fESP32\u3092Wi-Fi\u63a5\u7d9a\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>Wi-Fi\u63a5\u7d9a\u306f\u7d50\u69cb\u7c21\u5358\u3067\u3001MicroPython Doc\u306eESP32\u7528\u30af\u30a4\u30c3\u30af\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<a href=\"https:\/\/micropython-docs-ja.readthedocs.io\/ja\/latest\/esp32\/quickref.html\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"https:\/\/micropython-docs-ja.readthedocs.io\/ja\/latest\/esp32\/quickref.html\">https:\/\/micropython-docs-ja.readthedocs.io\/ja\/latest\/esp32\/quickref.html<\/a>\u306b\u8a73\u3057\u304f\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u3053\u308c\u3092\u305d\u3063\u304f\u308a\u8e0f\u8972\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u306fTera Term\u4e0a\u3067\u30b3\u30de\u30f3\u30c9\u3067\u306e\u53cd\u5fdc\u3092\u898b\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt; wlan = network.WLAN(network.STA_IF)\u3000\u3000\u3000#Wi-Fi\u3092\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u30e2\u30fc\u30c9\u306b\u3057\u307e\u3059\n&gt;&gt;&gt; wlan.active(True)\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000#\u30a2\u30af\u30c6\u30a3\u30d6\u5316\u78ba\u8a8d\u3057\u307e\u3059\nTrue\n&gt;&gt;&gt; wlan.connect('essid','password')\u3000\u3000\u3000\u3000\u3000#essid\u306b\u306f\u3064\u306a\u3050Wi-Fi\u306eessid\u3092\u3001password\u306b\u306f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u308c\u307e\u3059\n&gt;&gt;&gt; print('network config:',wlan.ifconfig())\u3000#Wi-Fi\u63a5\u7d9a\u306e\u30b3\u30f3\u30d5\u30a3\u30ae\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u30d7\u30ea\u30f3\u30c8\u3057\u307e\u3059\u3001ip\u30a2\u30c9\u30ec\u30b9\u3001\u30b5\u30d6\u30cd\u30c3\u30c8\u3001\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u30a2\u30c9\u30ec\u30b9\u3001DNS\u30a2\u30c9\u30ec\u30b9\nnetwork config: ('192.168.11.25', '255.255.255.0', '192.168.11.1', '192.168.11.1')\n&gt;&gt;&gt;\n&gt;&gt;&gt; wlan.scan()\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000#Wi-Fi\u306e\u96fb\u6ce2\u306e\u30b9\u30ad\u30e3\u30f3\u3092\u3057\u307e\u3059\n&#91;(b'Buffalo-G-****', b'4=\\xc4\\xc3\\x17\\x98', 11, -41, 3, False), (b'rs500m-e17ec9-1', b'\\x10KF\\xe1~\\xcc', 6, -67, 3, False), (b'rs500m-e17ec9-2', b'\\x12KF\\xe1~\\xcc', 6, -69, 3, False), (b'TOBU_Free_Wi-Fi', b'\\x00\\x14\\x06(\\x191', 1, -84, 0, False), (b'aterm-36fa28-g', b'\\x10f\\x82M\\xd2\\x08', 8, -85, 4, False), (b'SPWH_H33_129E8B', b'0\\xa1\\xfa\\x12\\x9e\\x8b', 2, -86, 4, False)]\n&gt;&gt;&gt;<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u3067\u3001Wi-Fi\u3078\u306e\u63a5\u7d9a\u304c\u3067\u304d\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u5b9f\u969b\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u30af\u30a4\u30c3\u30af\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306b\u3042\u308b\u3088\u3046\u306b\u3001\u95a2\u6570\u3067\u5b9a\u7fa9\u3057\u3066\u3001\u3064\u306a\u3052\u3070\u30aa\u30c3\u30b1\u30fc\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"theme:github toolbar:1 show-lang:1 scroll:true lang:python decode:true \" title=\"wifitest.py\" >def do_connect():\n    import network\n    wlan = network.WLAN(network.STA_IF)\n    wlan.active(True)\n    if not wlan.isconnected():\n        print('connecting to network...')\n        wlan.connect('essid', 'password')\n        while not wlan.isconnected():\n            pass\n    print('network config:', wlan.ifconfig())\n\ndo_connect()<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><\/div>\n\n\n\n<p>ampy\u3092\u4f7f\u7528\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8d70\u3089\u305b\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\Users\\&gt;ampy -p com4 run c:\\micropython\\wifitest.py\nconnecting to network...\nnetwork config: ('192.168.11.25', '255.255.255.0', '192.168.11.1', '192.168.11.1')<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306fESP32\u3092Wi-Fi\u63a5\u7d9a\u3057\u3066\u307f\u307e\u3057\u305f\u3002 Wi-Fi\u63a5\u7d9a\u306f\u7d50\u69cb\u7c21\u5358\u3067\u3001MicroPython Doc\u306eESP32\u7528\u30af\u30a4\u30c3\u30af\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9https:\/\/micropython-docs-ja.readthedocs. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sakae-shokai.com\/wordpress\/?p=306\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;ESP32 \u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u63a5\u7d9a&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":234,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,16],"tags":[18,19,36],"class_list":["post-306","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-micropython","tag-esp32","tag-micropython","tag-wi-fi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306"}],"version-history":[{"count":6,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/306\/revisions"}],"predecessor-version":[{"id":332,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/306\/revisions\/332"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=\/wp\/v2\/media\/234"}],"wp:attachment":[{"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sakae-shokai.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}