{"id":3313,"date":"2023-03-08T16:58:45","date_gmt":"2023-03-08T08:58:45","guid":{"rendered":"https:\/\/resource.webduino.io\/?p=3313"},"modified":"2023-03-28T10:19:33","modified_gmt":"2023-03-28T02:19:33","slug":"webai","status":"publish","type":"docs","link":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai","title":{"rendered":"\u4f7f\u7528 IDE \u958b\u767c Web:AI"},"content":{"rendered":"<p>Web:AI \u958b\u767c\u677f\u9664\u4e86\u53ef\u4ee5\u7528\u7a0b\u5f0f\u7a4d\u6728\u5e73\u53f0\u64cd\u4f5c\u5916\uff0c\u751a\u81f3\u4e5f\u652f\u63f4\u76f4\u63a5\u5728 IDE \u4e0a\u64b0\u5beb Python \u7a0b\u5f0f\uff0c\u4e26\u900f\u904e\u958b\u767c\u677f\u57f7\u884c\u3002<\/p>\n<blockquote><p>IDE\uff1aIntegrated Development Environment ( \u6574\u5408\u958b\u767c\u74b0\u5883 )\uff0c\u4e00\u7a2e\u8f14\u52a9\u958b\u767c\u8edf\u9ad4\u7684\u61c9\u7528\u7a0b\u5f0f\uff0c\u5728\u5de5\u5177\u5167\u90e8\u5c31\u80fd\u5920\u7de8\u5beb\u539f\u59cb\u78bc\uff0c\u4e26\u6253\u5305\u6210\u53ef\u7528\u7684\u7a0b\u5f0f\u3002<\/p><\/blockquote>\n<h3>\u8173\u4f4d\u5b9a\u7fa9<\/h3>\n<p><img fetchpriority=\"high\" decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_d5da331e3584dcf99ae0d4d0b770acf1.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h2>\u958b\u767c\u74b0\u5883\u4ecb\u7d39<\/h2>\n<p>Web:AI \u958b\u767c\u677f\u53ef\u914d\u5408 <a href=\"https:\/\/maixpy.sipeed.com\/\">Sipeed\u516c\u53f8<\/a> \u63a8\u51fa\u7684 MaixPy IDE \u4f7f\u7528\uff0c\u8a72 IDE \u96d6\u7136\u6c92\u6709\u958b\u6e90\uff0c\u4f46\u63d0\u4f9b\u4e86\u7a0b\u5f0f\u7de8\u5beb\u6574\u5408\u958b\u767c\u74b0\u5883\uff0c\u53ef\u4ee5\u64b0\u5beb MicroPython \u4e26\u50b3\u9001\u5230 Web:AI \u958b\u767c\u677f\u4e2d\u57f7\u884c\uff0c\u6b61\u8fce\u53c3\u8003\u4e0b\u65b9\u64cd\u4f5c\u6b65\u9a5f\u3002<\/p>\n<p>\u958b\u767c\u74b0\u5883\u756b\u9762\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" alt=\"MaixPy\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_81c4247711446de3b89009483a0f36e5.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h2>\u4f7f\u7528 kflash_gui \u66f4\u65b0\u6a19\u6e96\u7248\u97cc\u9ad4<\/h2>\n<p>\u9700\u8981\u5148\u4f7f\u7528 kflash_gui \u5c07 Web:AI \u97cc\u9ad4\u6a94\u6848\u71d2\u9304\u81f3\u958b\u767c\u677f\u4e2d\uff0c\u624d\u80fd\u900f\u904e MaixPy IDE \u4f7f\u7528 Web:AI \u529f\u80fd\u3002<\/p>\n<blockquote><p>\u71d2\u9304\u524d\u8acb\u5148\u900f\u904e USB \u7dda\u5c07 Web:AI \u958b\u767c\u677f\u63a5\u4e0a\u96fb\u8166\u3002<\/p><\/blockquote>\n<h3>\u4f7f\u7528 kflash_gui \u71d2\u9304<\/h3>\n<ol>\n<li>\u4e0b\u8f09 <a href=\"https:\/\/webduino.s3.ap-northeast-2.amazonaws.com\/webai\/production-firmware\/webduino\/webai_latest.kfpkg\">Web:AI \u97cc\u9ad4\u6a94\u6848<\/a>\u3002<\/li>\n<li>\u4e0b\u8f09 <a href=\"https:\/\/github.com\/sipeed\/kflash_gui\/releases\/tag\/v1.6.7\">kflash_gui<\/a>\uff0c\u9ede\u64ca\u57f7\u884c\uff0c\u958b\u555f webai.kfpkg \u97cc\u9ad4\u6a94\uff0c\u7b49\u5f85\u4e0b\u8f09\u5b8c\u7562\u5f8c\u5c31\u71d2\u9304\u5b8c\u6210\u4e86\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_ce3be2497b3bbb94d08f5d14df8ffc09.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<ol>\n<li>kflash_gui \u53c3\u6578\u8a2d\u5b9a\u756b\u9762\u5982\u4e0b\uff0c\u5982\u679c\u71d2\u9304\u7570\u5e38\uff0c\u53ef\u5617\u8a66\u8abf\u6574\u71d2\u9304\u7684\u901f\u5ea6<\/li>\n<\/ol>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_7e9b1dddd437cb218a9afe4119ad4db1.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<blockquote><p>\u6709\u95dc\u66f4\u8a73\u76e1\u7684\u6b65\u9a5f\u6559\u5b78\uff0c\u6b61\u8fce\u53c3\u8003\uff1a<a href=\"https:\/\/resource.webduino.io\/webai\/develop\/kflash\">kflash \u66f4\u65b0\u97cc\u9ad4<\/a><\/p><\/blockquote>\n<h2>\u4f7f\u7528 MaixPy IDE \u57f7\u884c\u6307\u4ee4<\/h2>\n<h3>1. \u4e0b\u8f09 MaixPy IDE\uff1a<\/h3>\n<p>\u9ede\u64ca <a href=\"https:\/\/drive.google.com\/drive\/u\/0\/folders\/1AhEgANgd8PxQOlZgmxWc8JhbpstaIXDS\">MaixPy IDE<\/a> \u4e0b\u8f09\uff0c\u5b89\u88dd\u5f8c\u958b\u555f MaixPy IDE \u61c9\u7528\u7a0b\u5f0f\uff0c\u9032\u5165\u958b\u767c\u74b0\u5883\u756b\u9762\u3002<\/p>\n<p><img decoding=\"async\" alt=\"MaixPy IDE \u4ecb\u9762\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_ef24ff8d1880128fa54c87a49cc5105f.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h3>2. \u65b0\u5efa\u6a94\u6848\uff1a<\/h3>\n<p>\u9ede\u64ca\u5de6\u5074\u5074\u908a\u6b04\u300c\u65b0\u5efa\u6a94\u6848\u300d\u6309\u9215 ( \u767d\u8272\u8cc7\u6599\u5716\u793a )\uff0c\u5728\u9801\u9762\u4e2d\u53ef\u4ee5\u81ea\u884c\u8f38\u5165 Python \u7a0b\u5f0f\u78bc\u3002\u53ef\u4ee5\u76f4\u63a5\u8907\u88fd\u4e0b\u65b9\u7684\u7a0b\u5f0f\u78bc\u7bc4\u4f8b\uff0c\u8cbc\u5728\u7de8\u8f2f\u756b\u9762\u4e2d\uff0c\u57f7\u884c\u7bc4\u4f8b\u5c55\u793a\u3002<\/p>\n<h3>3. \u9078\u64c7\u958b\u767c\u677f\uff1a<\/h3>\n<p>\u9ede\u64ca\u4e0a\u65b9\u300c\u5de5\u5177\u300d&gt;\u300c\u9078\u64c7\u958b\u767c\u677f\u300d&gt;\u300cSipeed Maix Bit ( with Mic )\u300d\uff0c\u4ee3\u8868\u9078\u64c7\u63a7\u5236 Web:AI \u958b\u767c\u677f\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_5cf48d37570d61c20fa0f3cc0f94debe.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h3>4. \u958b\u555f\u7d42\u7aef<\/h3>\n<ol>\n<li>\u9ede\u64ca\u4e0a\u65b9\u300c\u5de5\u5177\u300d&gt;\u300c\u958b\u555f\u7d42\u7aef\u300d&gt;\u300c\u65b0\u7d42\u7aef\u300d<\/li>\n<\/ol>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_3abe5bed046bbf41d2914681d4fd0daf.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<ol>\n<li>\u9078\u64c7\u300c\u9023\u7dda\u5230\u5e8f\u5217\u57e0\u300d<\/li>\n<\/ol>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_6add55ea4c6d108b5fe3cad6542724db.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h3>5. \u958b\u555f Web:AI<\/h3>\n<ol>\n<li>\u958b\u555f\u7d42\u7aef\u5f8c\uff0c\u6703\u770b\u5230\u5982\u4e0b\u756b\u9762\uff1a<\/li>\n<\/ol>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_e59c37efecb5c1b2527510b9a2889417.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<ol>\n<li>\u5728 IDE \u4e2d\u8f38\u5165\u7a0b\u5f0f\u78bc\uff0c\u6309\u4e0b\u57f7\u884c\uff0c\u5373\u53ef\u5728\u76f4\u63a5\u7d42\u7aef\u4e2d\u67e5\u770b\u57f7\u884c\u7d50\u679c\u3002<\/li>\n<\/ol>\n<h2>\u7a0b\u5f0f\u7bc4\u4f8b<\/h2>\n<p>\u4f7f\u7528 Python \u7a0b\u5f0f\u6642\uff0c\u53ef\u4ee5\u76f4\u63a5\u8907\u88fd\u4e0b\u65b9\u7684\u7a0b\u5f0f\u78bc\u7bc4\u4f8b\uff0c\u8cbc\u5728\u7de8\u8f2f\u756b\u9762\u4e2d\uff0c\u57f7\u884c\u7bc4\u4f8b\u5c55\u793a\u3002<\/p>\n<h2>\u611f\u6e2c\u5668<\/h2>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_22df52e5a1be1ec587fe04a042634959.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h3>\u7bc4\u4f8b\uff1a\u651d\u50cf\u982d Sensor<\/h3>\n<ul>\n<li>\u7a0b\u5f0f\u5167\u5bb9\uff1a\u4f7f\u7528 Web:AI \u5167\u5efa\u7684\u651d\u50cf\u982d\u6355\u6349\u756b\u9762\uff0c\u5373\u6642\u986f\u793a\u5230 LCD \u87a2\u5e55\u4e2d\u3002<\/li>\n<\/ul>\n<p>~~~python=<br \/>\nfrom webai import *<\/p>\n<p>pic = webai.snapshot()<br \/>\nwebai.show(img=pic)<\/p>\n<pre><code>\n![](https:\/\/photo.webduino.io\/resource\/webai\/upload_f733579dd18caea93542ce6b2d672d00.webp)\n\n## \u87a2\u5e55 LCD \u986f\u793a\n\n![](https:\/\/photo.webduino.io\/resource\/webai\/upload_9a95715444776fa01a7afcef8c36b4d5.webp)\n\n### \u7bc4\u4f8b\uff1a\u986f\u793a\u6587\u5b57\n\n- \u7a0b\u5f0f\u5167\u5bb9\uff1a\u8f38\u5165\u6307\u5b9a\u7684\u6587\u5b57\u3001\u4f4d\u7f6e\u3001\u6a23\u5f0f\uff0c\u4e26\u986f\u793a\u5728 LCD \u87a2\u5e55\u4e0a\u3002\n\n- ==lcd.draw_string( x \u5ea7\u6a19 , y \u5ea7\u6a19 , \" \u6587\u5b57 \" , \u6587\u5b57\u984f\u8272 , \u80cc\u666f\u984f\u8272 )==\n\n~~~python=\nfrom webai import *\n\nwebai.draw_string(30,10,\"\u6e2c\u8a66 OK\",scale=2)\n<\/code><\/pre>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_a8feb305b558a728a5191fc20c98ab12.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h3>\u7bc4\u4f8b\uff1a\u756b\u7dda<\/h3>\n<ul>\n<li>\u7a0b\u5f0f\u5167\u5bb9\uff1a\u8a2d\u5b9a\u7dda\u6bb5\u7684 2 \u500b\u7aef\u9ede\u4f4d\u7f6e\u3001\u984f\u8272\u3001\u5bec\u5ea6\uff0c\u7e6a\u88fd\u5728 LCD \u87a2\u5e55\u4e0a\u3002\u4e5f\u53ef\u540c\u6642\u7e6a\u88fd\u591a\u689d\u7dda\u6bb5\u3002<\/li>\n<li>==img.draw_line( x \u5ea7\u6a19 , y \u5ea7\u6a19 , x \u5ea7\u6a19 , y \u5ea7\u6a19 , \u984f\u8272 , \u7dda\u6bb5\u5bec\u5ea6 )==<\/li>\n<\/ul>\n<p>~~~python=<br \/>\nfrom webai import *<\/p>\n<p>webai.img = image.Image()<br \/>\nwebai.img.draw_line(10,150,310,150,color=lcd.RED,thickness=20)<br \/>\nwebai.show(img=webai.img)<\/p>\n<pre><code>\n![](https:\/\/photo.webduino.io\/resource\/webai\/upload_bd152fa8f05d75d8a0404446c60be2af.webp)\n\n## \u6309\u9215\n\n### \u7bc4\u4f8b\uff1a\u6309\u9215\u63a7\u5236\n\n- \u7a0b\u5f0f\u5167\u5bb9\uff1a\u6309 L \u6309\u9215\u986f\u793a A\uff0c\u6309 R \u6309\u9215\u986f\u793a B\u3002\n\n- ==webai.draw_string( x \u5ea7\u6a19 , y \u5ea7\u6a19 , \" \u82f1\u6587\u6578\u5b57 \", \u6587\u5b57\u7e2e\u653e )==\n\n~~~python=\nfrom webai import *\n# state=1:click_down , state=2:click_up , state=3:long_press \ndef click(name,state):\n    webai.img.clear()\n    if name == 'btnL' and state == 1:\n        webai.draw_string(60, 100, \"A\", scale=4)    \n    if name == 'btnR' and state == 1:\n        webai.draw_string(220, 100, \"B\", scale=4)    \n\nwebai.img = image.Image()\nwebai.addBtnListener(click)\n<\/code><\/pre>\n<p><img decoding=\"async\" alt=\"LR\u6309\u9215\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_1ebffb83a09532397e2dd8f9092721f2.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h3>\u7bc4\u4f8b\uff1a\u6309\u9215\u63a7\u5236 &#8211; \u76e3\u807d\u6240\u6709\u6309\u9215\u4e8b\u4ef6<\/h3>\n<p>\u6309\u9375\u4e8b\u4ef6\u7e3d\u5171\u6709 7 \u7a2e\u4e8b\u4ef6<\/p>\n<p>L(\u5de6\u9375):  name==&#8217;btnL&#8217; , state==1:\u6309\u4e0b , state==2:\u653e\u958b , state==3:\u9577\u6309\u8d85\u904e2\u79d2<br \/>\nR(\u53f3\u9375):  name==&#8217;btnR&#8217; , state==1:\u6309\u4e0b , state==2:\u653e\u958b , state==3:\u9577\u6309\u8d85\u904e2\u79d2<br \/>\nL + R : state == 4 (\u5de6\u53f3\u6309\u9375\u4e00\u8d77\u6309)<br \/>\n~~~python=<br \/>\nfrom webai import *<\/p>\n<h1>state=1:click_down , state=2:click_up , state=3:long_press<\/h1>\n<p>def click(name,state):<br \/>\nwebai.img.clear()<br \/>\n# \u6309\u4e0b\u5de6\u9375<br \/>\nif name == &#8216;btnL&#8217; and state == 1:<br \/>\nwebai.draw_string(60, 100, &#8220;A&#8221;, scale=4)<br \/>\n# \u653e\u958b\u5de6\u9375<br \/>\nif name == &#8216;btnL&#8217; and state == 2:<br \/>\nwebai.draw_string(60, 100, &#8221; &#8220;, scale=4)<br \/>\n# \u9577\u6309\u5de6\u9375\u8d85\u904e2\u79d2<br \/>\nif name == &#8216;btnL&#8217; and state == 3:<br \/>\nwebai.draw_string(50, 100, &#8220;A!&#8221;, scale=4)<\/p>\n<pre><code># \u6309\u4e0b\u53f3\u9375\nif name == 'btnR' and state == 1:\n    webai.draw_string(220, 100, \"B \", scale=4)\n# \u6309\u4e0b\u53f3\u9375\nif name == 'btnR' and state == 2:\n    webai.draw_string(220, 100, \" \", scale=4)\n# \u9577\u6309\u53f3\u9375\u8d85\u904e2\u79d2\nif name == 'btnR' and state == 3:\n    webai.draw_string(210, 100, \"B!\", scale=4)\n\n# \u5de6\u9375+\u53f3\u9375\u4e00\u8d77\u6309\nif state == 4:\n    webai.draw_string(50, 100, \"A  +  B\", scale=4)\n<\/code><\/pre>\n<p>webai.img = image.Image()<br \/>\nwebai.addBtnListener(click)<\/p>\n<pre><code>\n\n### \u7bc4\u4f8b\uff1a\u6309\u9215\u62cd\u7167\u986f\u793a\u7167\u7247\n\n- \u7bc4\u4f8b\u7a0b\u5f0f\uff1a\n    1. \u6309\u4e0b L \u6309\u9215\u9032\u884c\u62cd\u7167\u4e26\u5beb\u6a94\n    2. \u9577\u6309 R \u6309\u9215\u5c07\u7167\u7247\u986f\u793a\u5728 LCD \u87a2\u5e55\u4e0a\n    3. \u518d\u6309\u4e00\u4e0b R \u6309\u9215\u6062\u5fa9\u62cd\u651d\u6a21\u5f0f\n\n~~~python=\nfrom webai import *\n\ndef click(name,state):\n    global show\n    if name == 'btnL' and state == 2:\n        webai.img = webai.snapshot()\n        webai.img.save('myImg.jpg')\n        print(\"save OK\")\n    if name == 'btnR' and state == 1:        \n        show = False\n    if name == 'btnR' and state == 3:\n        show = True\n        webai.show(file = 'myImg.jpg')\n\nshow = False\nwebai.addBtnListener(click)\nwhile True:\n    if not show:\n        webai.img = webai.snapshot()\n        webai.show(img = webai.img)\n<\/code><\/pre>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_12a14b46fe9eede0762043451dc8dead.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<h2>\u8173\u4f4d\u63a7\u5236<\/h2>\n<h3>\u7bc4\u4f8b\uff1a\u8b80\u53d6\u985e\u6bd4\u8173\u4f4d<\/h3>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_1bf8dec7eceade62de536f34c0b58f74.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<ul>\n<li>\u8b80\u53d6 pin4 \u985e\u6bd4\u8a0a\u865f\uff0c\u6578\u503c\u4ecb\u65bc 0~1023 \uff0c\u96fb\u58d3\u662f 0~1V\u3002<\/li>\n<li>\u7a0b\u5f0f\u5167\u5bb9\uff1a\u7528\u624b\u89f8\u78b0\u985e\u6bd4\u8173 ( pin4 )\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u87a2\u5e55\u986f\u793a\u6578\u503c\u4e0a\u5347\u5230 1023\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/i0.wp.com\/photo.webduino.io\/resource\/webai\/upload_3bdfbbf6eeae5225db112f9998e95362.webp?w=1200&#038;ssl=1\" data-recalc-dims=\"1\"><\/p>\n<p>~~~python=<br \/>\nfrom webai import *<br \/>\nwhile True:<br \/>\nval = webai.adc()<br \/>\nimg = image.Image()<br \/>\nimg.draw_string(120, 100, str(val), scale=4)<br \/>\nlcd.display(img)<br \/>\ntime.sleep(0.1)<br \/>\nlcd.clear()<\/p>\n<pre><code>\n## \u5916\u63a5\u5587\u53ed\u3001SD\u5361\n\n### \u4f7f\u7528\u5587\u53ed\u64ad\u653e\u97f3\u6a94\n\n![](https:\/\/photo.webduino.io\/resource\/webai\/upload_6e7808c81c364f6a2f5900f878fa8347.webp)\n\n- \u7a0b\u5f0f\u5167\u5bb9\uff1a\u64ad\u653e wav \u6a94\u3002\n\n~~~python=\nfrom webai import *\nwebai.speaker.setVolume(100)\nwebai.speaker.play(filename='logo.wav',sample_rate=11025)\n<\/code><\/pre>\n<h2>Wi-Fi \u8a2d\u5b9a<\/h2>\n<h3>\u8a2d\u5b9a\u958b\u767c\u677f\u9023\u7dda Wi-Fi<\/h3>\n<ul>\n<li>\u7a0b\u5f0f\u5167\u5bb9\uff1a\u900f\u904e Wi-Fi \u9023\u4e0a\u7db2\u8def\uff0c\u5982\u679c\u8a66\u4e86\u4e09\u6b21\u90fd\u9023\u4e0d\u4e0a\uff0c\u5c31\u986f\u793a\u7570\u5e38\u3002\n<ul>\n<li>\u7b2c\u4e8c\u884c\uff1a\u8a2d\u5b9a Wi-Fi \u7684 SSID \u548c PWD<\/li>\n<li>\u7b2c\u516d\u884c\uff1a\u5132\u5b58 Wi-Fi \u8a2d\u5b9a<\/li>\n<li>\u7b2c\u4e03\u884c\uff1a\u958b\u767c\u677f\u91cd\u958b\u6a5f<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>~~~python=<br \/>\nfrom webai import *<br \/>\nwifi = {<br \/>\n&#8216;ssid&#8217;:&#8217;webduino.io&#8217;,<br \/>\n&#8216;pwd&#8217;:&#8217;webduino&#8217;<br \/>\n}<br \/>\nwebai.cfg.put(&#8216;wifi&#8217;, wifi)<br \/>\nwebai.reset()<\/p>\n<pre><code>\n## MQTT\n\n&gt; \u5efa\u8b70\u4f7f\u7528 Webduino \u63d0\u4f9b\u7684\u7a0b\u5f0f\u5eab\uff0c\u6bd4\u8f03\u65b9\u4fbf\u4f7f\u7528\u3002\n\n### MQTT \u8a02\u95b1\u8cc7\u6599\n\n- \u7a0b\u5f0f\u5167\u5bb9\uff1a\u8a02\u95b1\u983b\u9053 \" subTest \"\u3002\n    - \u7b2c\u4e09\u884c\uff1a\u5728\u87a2\u5e55\u4e0a\u986f\u793a\u5ee3\u64ad\u8a0a\u606f\n\n\u53ef\u900f\u904eWeb:Bit\u7bc4\u4f8b\u7a0b\u5f0f\u767c\u4f48\u8a0a\u606f\u9032\u884c\u6e2c\u8a66\nhttps:\/\/webbit.webduino.io\/blockly\/?demo=default#7qZr95m27k8qO\n~~~python=\nfrom webai import *\ndef msg(topic, msg):\n    webai.lcd.clear()\n    webai.draw_string(130, 100, \"%s\"%msg, scale=2, x_spacing=10)\nwebai.mqtt.sub('subTest', msg)\n<\/code><\/pre>\n<h3>MQTT \u767c\u884c\u8cc7\u6599<\/h3>\n<ul>\n<li>\u7a0b\u5f0f\u5167\u5bb9\uff1a\u5411\u983b\u9053 &#8221; subTest &#8221; \u50b3\u9001 &#8221; Hello Web:AI &#8220;\u3002\n<ul>\n<li>\u7b2c\u4e00\u884c\uff1a\u5b8c\u6210 MQTT \u9023\u7dda<\/li>\n<li>\u7b2c\u4e8c\u884c\uff1a\u50b3\u9001\u4e00\u7b46\u8cc7\u6599<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>~~~python=<br \/>\nfrom webai import *<br \/>\nwebai.mqtt.pub(&#8216;subTest&#8217;,&#8217;Hello Web:AI&#8217;)<\/p>\n<pre><code>\n\n## \u4e0b\u8f09\u6a94\u6848(\u6a21\u578b\u6a94\u6848\u3001SPIFFS..\u7b49) \u71d2\u9304\u5230\u6307\u5b9a\u7684 flash address\n\n\u4e0b\u9762\u9019\u7bc4\u4f8b\u7a0b\u5f0f\u662f\u66f4\u65b0webAI\u6a94\u6848\u7cfb\u7d71\n~~~python=\nurl = 'http:\/\/share.webduino.io\/storage\/download\/0605_143342.696_m_0x400000_maixpy_spiffs.img'\nwebai.cloud.download(url,address=0x400000,redirect=False,showProgress=True)\n<\/code><\/pre>\n<h2>\u900f\u904e UART \u548c Arduino\u6e9d\u901a<\/h2>\n<p>Arduino \u53ef\u4ee5\u900f\u904e UART \u548c Web:AI \u9023\u7dda\u50b3\u9001\u8cc7\u6599\uff0c\u4e0b\u9762\u7a0b\u5f0f\u7bc4\u4f8b\u662f\u8b93 ESP8266 \u50b3\u9001\u5b57\u5143\u7d66 Web:AI \u9032\u884c\u986f\u793a<\/p>\n<p>{%youtube c9VH46zGpps %}<br \/>\n~~~python=<br \/>\nfrom machine import UART<br \/>\nimport sensor, image, time, lcd<br \/>\nfrom fpioa_manager import fm<br \/>\nfrom Maix import GPIO<\/p>\n<p>fm.register(24, fm.fpioa.UART1_TX, force=True)<br \/>\nfm.register(25, fm.fpioa.UART1_RX, force=True)<br \/>\nuart = UART(UART.UART1, 57600, timeout=5000,read_buf_len=2048)<br \/>\nlcd.init()<br \/>\nimg = image.Image()<br \/>\nimg.draw_string(100,100,&#8217;Go&#8217;,scale=3)<br \/>\nlcd.display(img)<br \/>\nwhile True:<br \/>\nwhile uart.any():<br \/>\nmyLine = uart.readline()<br \/>\nimg.draw_string(100,100,myLine,scale=3)<br \/>\nlcd.display(img)<br \/>\nimg.clear()<\/p>\n<pre><code>\nArduino\n~~~c=\nvoid setup() {\n  Serial.begin(57600);\n  pinMode(15, OUTPUT);\n}\n\nvoid loop() {\n  Serial.println('A');\n  digitalWrite(15, HIGH);\n  delay(500);\n  Serial.println('B');\n  digitalWrite(15, LOW);\n  delay(500);\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Web:AI \u958b\u767c\u677f\u9664\u4e86\u53ef\u4ee5\u7528\u7a0b\u5f0f\u7a4d\u6728\u5e73\u53f0\u64cd\u4f5c\u5916\uff0c\u751a\u81f3\u4e5f\u652f\u63f4\u76f4\u63a5\u5728 IDE \u4e0a\u64b0\u5beb Python \u7a0b\u5f0f\uff0c\u4e26\u900f\u904e&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3373,"menu_order":2,"comment_status":"open","ping_status":"open","template":"","meta":{"inline_featured_image":false,"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"doc_tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528 IDE \u958b\u767c Web:AI | Webduino \u6559\u5b78\u8cc7\u6e90<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528 IDE \u958b\u767c Web:AI | Webduino \u6559\u5b78\u8cc7\u6e90\" \/>\n<meta property=\"og:description\" content=\"Web:AI \u958b\u767c\u677f\u9664\u4e86\u53ef\u4ee5\u7528\u7a0b\u5f0f\u7a4d\u6728\u5e73\u53f0\u64cd\u4f5c\u5916\uff0c\u751a\u81f3\u4e5f\u652f\u63f4\u76f4\u63a5\u5728 IDE \u4e0a\u64b0\u5beb Python \u7a0b\u5f0f\uff0c\u4e26\u900f\u904e...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai\" \/>\n<meta property=\"og:site_name\" content=\"Webduino \u6559\u5b78\u8cc7\u6e90\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-28T02:19:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/photo.webduino.io\/resource\/webai\/upload_d5da331e3584dcf99ae0d4d0b770acf1.webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai\",\"url\":\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai\",\"name\":\"\u4f7f\u7528 IDE \u958b\u767c Web:AI | Webduino \u6559\u5b78\u8cc7\u6e90\",\"isPartOf\":{\"@id\":\"https:\/\/resource.webduino.io\/#website\"},\"datePublished\":\"2023-03-08T08:58:45+00:00\",\"dateModified\":\"2023-03-28T02:19:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\/\/resource.webduino.io\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web:AI\",\"item\":\"https:\/\/resource.webduino.io\/docs\/webai\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"\u958b\u767c\u8005\u5c08\u5340\",\"item\":\"https:\/\/resource.webduino.io\/docs\/webai\/develop\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"\u4f7f\u7528 IDE \u958b\u767c Web:AI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/resource.webduino.io\/#website\",\"url\":\"https:\/\/resource.webduino.io\/\",\"name\":\"Webduino \u5b78\u7fd2\u8cc7\u6e90\u5eab\",\"description\":\"\u672c\u7db2\u7ad9\u63d0\u4f9b\u5b8c\u6574\u7684 Webduino STEAM \u6559\u80b2\u5b78\u7fd2\u8cc7\u6e90\uff0c\u5305\u542b\u958b\u767c\u677f\u3001\u7a0b\u5f0f\u7a4d\u6728\u3001\u96fb\u5b50\u96f6\u4ef6\u8207\u50b3\u611f\u5668\u7b49\u57fa\u790e\u64cd\u4f5c\uff0c\u8b93\u8001\u5e2b\u3001\u540c\u5b78\u3001maker \u80fd\u5920\u5feb\u901f\u4e0a\u624b Webduino\uff0c\u4e26\u4e0d\u5b9a\u671f\u66f4\u65b0\u8cc7\u8a0a\u6559\u80b2\u8da8\u52e2\u76f8\u95dc\u6587\u7ae0\u3002\",\"publisher\":{\"@id\":\"https:\/\/resource.webduino.io\/#organization\"},\"alternateName\":\"Webduino \u5b78\u7fd2\u8cc7\u6e90\u5eab\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/resource.webduino.io\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/resource.webduino.io\/#organization\",\"name\":\"Webduino\",\"url\":\"https:\/\/resource.webduino.io\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\/\/resource.webduino.io\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/resource.webduino.io\/wp-content\/uploads\/2022\/07\/logo\u900f\u660e\u5e95.png\",\"contentUrl\":\"https:\/\/resource.webduino.io\/wp-content\/uploads\/2022\/07\/logo\u900f\u660e\u5e95.png\",\"width\":1061,\"height\":1060,\"caption\":\"Webduino\"},\"image\":{\"@id\":\"https:\/\/resource.webduino.io\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528 IDE \u958b\u767c Web:AI | Webduino \u6559\u5b78\u8cc7\u6e90","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai","og_locale":"zh_TW","og_type":"article","og_title":"\u4f7f\u7528 IDE \u958b\u767c Web:AI | Webduino \u6559\u5b78\u8cc7\u6e90","og_description":"Web:AI \u958b\u767c\u677f\u9664\u4e86\u53ef\u4ee5\u7528\u7a0b\u5f0f\u7a4d\u6728\u5e73\u53f0\u64cd\u4f5c\u5916\uff0c\u751a\u81f3\u4e5f\u652f\u63f4\u76f4\u63a5\u5728 IDE \u4e0a\u64b0\u5beb Python \u7a0b\u5f0f\uff0c\u4e26\u900f\u904e...","og_url":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai","og_site_name":"Webduino \u6559\u5b78\u8cc7\u6e90","article_modified_time":"2023-03-28T02:19:33+00:00","og_image":[{"url":"https:\/\/photo.webduino.io\/resource\/webai\/upload_d5da331e3584dcf99ae0d4d0b770acf1.webp"}],"twitter_card":"summary_large_image","twitter_misc":{"\u9810\u4f30\u95b1\u8b80\u6642\u9593":"7 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai","url":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai","name":"\u4f7f\u7528 IDE \u958b\u767c Web:AI | Webduino \u6559\u5b78\u8cc7\u6e90","isPartOf":{"@id":"https:\/\/resource.webduino.io\/#website"},"datePublished":"2023-03-08T08:58:45+00:00","dateModified":"2023-03-28T02:19:33+00:00","breadcrumb":{"@id":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/resource.webduino.io\/docs\/webai\/develop\/webai#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/resource.webduino.io\/"},{"@type":"ListItem","position":2,"name":"Web:AI","item":"https:\/\/resource.webduino.io\/docs\/webai"},{"@type":"ListItem","position":3,"name":"\u958b\u767c\u8005\u5c08\u5340","item":"https:\/\/resource.webduino.io\/docs\/webai\/develop"},{"@type":"ListItem","position":4,"name":"\u4f7f\u7528 IDE \u958b\u767c Web:AI"}]},{"@type":"WebSite","@id":"https:\/\/resource.webduino.io\/#website","url":"https:\/\/resource.webduino.io\/","name":"Webduino \u5b78\u7fd2\u8cc7\u6e90\u5eab","description":"\u672c\u7db2\u7ad9\u63d0\u4f9b\u5b8c\u6574\u7684 Webduino STEAM \u6559\u80b2\u5b78\u7fd2\u8cc7\u6e90\uff0c\u5305\u542b\u958b\u767c\u677f\u3001\u7a0b\u5f0f\u7a4d\u6728\u3001\u96fb\u5b50\u96f6\u4ef6\u8207\u50b3\u611f\u5668\u7b49\u57fa\u790e\u64cd\u4f5c\uff0c\u8b93\u8001\u5e2b\u3001\u540c\u5b78\u3001maker \u80fd\u5920\u5feb\u901f\u4e0a\u624b Webduino\uff0c\u4e26\u4e0d\u5b9a\u671f\u66f4\u65b0\u8cc7\u8a0a\u6559\u80b2\u8da8\u52e2\u76f8\u95dc\u6587\u7ae0\u3002","publisher":{"@id":"https:\/\/resource.webduino.io\/#organization"},"alternateName":"Webduino \u5b78\u7fd2\u8cc7\u6e90\u5eab","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/resource.webduino.io\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-TW"},{"@type":"Organization","@id":"https:\/\/resource.webduino.io\/#organization","name":"Webduino","url":"https:\/\/resource.webduino.io\/","logo":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/resource.webduino.io\/#\/schema\/logo\/image\/","url":"https:\/\/resource.webduino.io\/wp-content\/uploads\/2022\/07\/logo\u900f\u660e\u5e95.png","contentUrl":"https:\/\/resource.webduino.io\/wp-content\/uploads\/2022\/07\/logo\u900f\u660e\u5e95.png","width":1061,"height":1060,"caption":"Webduino"},"image":{"@id":"https:\/\/resource.webduino.io\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/docs\/3313"}],"collection":[{"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/comments?post=3313"}],"version-history":[{"count":2,"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/docs\/3313\/revisions"}],"predecessor-version":[{"id":4597,"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/docs\/3313\/revisions\/4597"}],"up":[{"embeddable":true,"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/docs\/3373"}],"wp:attachment":[{"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/media?parent=3313"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/resource.webduino.io\/wp-json\/wp\/v2\/doc_tag?post=3313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}