{"id":32603,"date":"2023-05-10T08:03:32","date_gmt":"2023-07-26T21:12:20","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/"},"modified":"2024-04-30T03:27:15","modified_gmt":"2024-04-29T19:27:15","slug":"%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/","title":{"rendered":"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd"},"content":{"rendered":"<p>\u5fae\u578b\u7f16\u7a0b\u63a7\u5236\u5668Micro:bit\u57282020\u5e7411\u6708\u672b\u8fdb\u884c\u4e86\u5347\u7ea7\u3002<\/p>\n<p>\u56e0\u4e3a\u4ee5\u524d\u505a\u7684\u67d0\u4e2a\u6269\u5c55\u53ef\u80fd\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff0c\u6240\u4ee5\u6211\u8fdb\u884c\u4e86\u4e00\u6b21\u5927\u80c6\u7684\u5347\u7ea7\u3002<br \/>\nhttps:\/\/github.com\/pizayanz\/pxt-linebeacon<br \/>\n\uff08\u6b63\u5728\u8fdb\u884c\u4e2d\uff09<\/p>\n<p>\u6211\u5728 Qiita \u4e0a\u5e94\u8be5\u4e5f\u5199\u4e86\u5173\u4e8e\u6269\u5c55\u5236\u4f5c\u65b9\u6cd5\u7684\u6587\u7ae0\uff0c\u4f46\u662f\u53d1\u73b0\u53ea\u662f\u4e2a\u4e2d\u9014\u800c\u505c\u7684\u8349\u7a3f\u3002\u6211\u771f\u662f\u4e2a\u5931\u8d25\u554a\u3002<br \/>\n\u5e0c\u671b\u501f\u6b64\u53cd\u7701\uff0c\u6211\u6253\u7b97\u5373\u4f7f\u662f\u4e2d\u9014\u800c\u505c\u7684\u6587\u7ae0\u4e5f\u516c\u5f00\u51fa\u6765\uff0c\u4e00\u8fb9\u6162\u6162\u8fdb\u884c\u5de5\u4f5c\uff0c\u4e00\u8fb9\u8fdb\u884c\u589e\u8865\u3002<\/p>\n<p>\u65e0\u8bba\u8bb0\u8f7d\u5185\u5bb9\u5982\u4f55\u53d8\u5316\uff0c\u8bf7\u60a8\u539f\u8c05\u3002<br \/>\n\u65e0\u8bba\u662f\u4e00\u76f4\u5230\u672a\u6765\u6c38\u8fdc\uff0c\u8fd8\u662f\u4e2d\u9014\u534a\u7aef\uff0c\u8bf7\u60a8\u539f\u8c05\u3002<\/p>\n<p>\u53ea\u8981\u628a\u5361\u5728\u8fd9\u91cc\u7684\u5730\u65b9\u4e0a\u4f20\uff0c\u6216\u8bb8\u53ef\u4ee5\u5e2e\u52a9\u5230\u5904\u4e8e\u540c\u6837\u60c5\u51b5\u7684\u4eba\u4eec&#8230;\u8fd9\u662f\u6211\u7684\u60f3\u6cd5\uff0c\u8bf7\u539f\u8c05\u6211\u3002<\/p>\n<p>\u4e0d\u4ec5\u4ec5\u4f7f\u7528TypeScript\uff0c\u4e5f\u4f7f\u7528\u4e86C++\uff08cpp\uff09\uff0c\u56e0\u6b64\u5728\u6280\u672f\u5c42\u9762\u4e0a\u53ef\u80fd\u4f1a\u66f4\u52a0\u6df1\u5165\uff0c\u4f46\u662f\u5bf9\u4e8e\u53ea\u60f3\u7528TypeScript\u521b\u5efa\u6269\u5c55\u7684\u4eba\u6765\u8bf4\uff0c\u4e5f\u6709\u4e00\u4e9b\u76f8\u540c\u7684\u969c\u788d\u70b9\uff0c\u6240\u4ee5\u4e00\u90e8\u5206\u5185\u5bb9\u53ef\u80fd\u5bf9\u4ed6\u4eec\u6709\u53c2\u8003\u4ef7\u503c\u3002<\/p>\n<h2>\u8f7b\u677e\u7684\u89e6\u53d1\u70b9<\/h2>\n<p>\u622a\u6b62\u52302020\u5e7411\u6708\u3002<\/p>\n<p>micro:bit (\u57fa\u677f\u81ea\u4f53) \u662f v2 (Version 2)<\/p>\n<p>makecode\uff08\u4e00\u4e2a\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff09\u73b0\u5728\u5df2\u7ecf\u5347\u7ea7\u5230v3\uff08\u7b2c\u4e09\u7248\u672c\uff09\u3002<\/p>\n<p>\u55ef\uff0c\u4e3a\u4e86\u4ee5\u9632\u4e07\u4e00\uff0c\u8ba9\u6211\u4eec\u4e8b\u5148\u4e86\u89e3\u4e00\u4e0b\u3002<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0cMakeCode \u7ecf\u5e38\u4f1a\u4ee5 PXT \u8fd9\u4e2a\u540d\u79f0\u51fa\u73b0\u3002<\/p>\n<p>PXT \u662f Microsoft \u7f16\u7a0b\u4f53\u9a8c\u5de5\u5177\u5305\u7684\u7b80\u79f0\u3002<br \/>\n\u867d\u7136\u6709\u5404\u79cd\u7248\u672c\uff0c\u4f46\u9488\u5bf9 micro:bit \u7684\u7248\u672c\u5c31\u662f pxt-microbit\u3002<\/p>\n<h2>\u975e\u5e38\u5f15\u4eba\u5173\u6ce8\u7684\u7126\u70b9<\/h2>\n<p>\u5728Typescript\u4e2d\u5b9a\u4e49\u6269\u5c55\u65f6\uff0c\u5982\u679c\u60f3\u8981\u4f7f\u7528C++\uff0c\u4e5f\u9700\u8981\u51c6\u5907extension.cpp\u7b49\u4ee3\u7801\u6587\u4ef6\u3002<\/p>\n<p>\u8fd9\u4e2a\u533a\u522b\u662f\u8fd9\u6837\u7684\uff0c\u7b80\u5355\u6765\u8bf4\uff0cts \u662f\u7528\u4e8e MakeCode \u5185\u7684\u6a21\u62df\u5668\u3002<br \/>\ncpp \u5219\u7528\u4e8e micro:bit \u5185\u8fd0\u884c\u7684\u7269\u4f53\u3002<\/p>\n<h3>\u9996\u5148\u786e\u8ba4<\/h3>\n<h3>\u5173\u4e8e\u7a7a\u7684\u51fd\u6570<\/h3>\n<p>\u6d4f\u89c8\u8fd9\u4e2a\u7f51\u9875\uff0c\u6211\u4eec\u5c06\u5f00\u59cb\u521b\u5efa\u79ef\u6728\uff1a<br \/>\nhttps:\/\/makecode.com\/defining-blocks<\/p>\n<p>\u8fd9\u4e0d\u884c\u3002\u867d\u7136\u4e0d\u592a\u660e\u767d\uff0c\u4f46\u662f\u6ca1\u6709\u6210\u529f\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"cm\">\/**\r\n* this is hoge\r\n*\/<\/span>\r\n<span class=\"c1\">\/\/% blockId=hoge<\/span>\r\n<span class=\"c1\">\/\/% block=\"Hoge\"<\/span>\r\n<span class=\"c1\">\/\/% block.loc.ja=\"\u307b\u3052\"<\/span>\r\n<span class=\"c1\">\/\/% weight=10 blockGap=8 shim=hogehoge::hoge<\/span>\r\n<span class=\"k\">export<\/span> <span class=\"kd\">function<\/span> <span class=\"nx\">hoge<\/span><span class=\"p\">():<\/span> <span class=\"k\">void<\/span> <span class=\"p\">{<\/span>\r\n<span class=\"p\">}<\/span>\r\n<\/code><\/pre>\n<p>\u8fd9\u4e9b\u90fd\u8fd8\u4e0d\u9519\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"cm\">\/**\r\n* this is hoge\r\n*\/<\/span>\r\n<span class=\"c1\">\/\/% blockId=hoge<\/span>\r\n<span class=\"c1\">\/\/% block=\"Hoge\"<\/span>\r\n<span class=\"c1\">\/\/% block.loc.ja=\"\u307b\u3052\"<\/span>\r\n<span class=\"c1\">\/\/% weight=10 blockGap=8 shim=hogehoge::hoge<\/span>\r\n<span class=\"k\">export<\/span> <span class=\"kd\">function<\/span> <span class=\"nx\">hoge<\/span><span class=\"p\">():<\/span> <span class=\"k\">void<\/span> <span class=\"p\">{<\/span>\r\n    <span class=\"k\">return<\/span><span class=\"p\">;<\/span>\r\n<span class=\"p\">}<\/span> \r\n\r\n\r\n<span class=\"err\">\u203b<\/span><span class=\"nx\">\u306d\u3076\u304b\u3044\u4ef6<\/span>\r\n\r\n<span class=\"p\">.<\/span><span class=\"nx\">cpp<\/span> <span class=\"nx\">\u3057\u304b\u30b3\u30fc\u30c9\u304c\u5fc5\u8981\u304c\u306a\u3044\u3068\u304d\u306f<\/span><span class=\"err\">\u3001<\/span><span class=\"nx\">cpp<\/span> <span class=\"nx\">\u5074\u306b\u30d6\u30ed\u30c3\u30af\u5b9a\u7fa9\u3092\u3057\u304b\u308b\u3079\u304f\u5b9a\u7fa9\u3059\u308c\u3070<\/span><span class=\"err\">\u3001<\/span>\r\n<span class=\"p\">.<\/span><span class=\"nx\">ts<\/span> <span class=\"nx\">\u5074\u306f\u7701\u7565\u3057\u3066\u3082\u3088\u3044\u3068\u3044\u3046\u4ed5\u69d8<\/span><span class=\"err\">\u3002<\/span>\r\n\r\n<span class=\"p\">.<\/span><span class=\"nx\">ts<\/span> <span class=\"nx\">\u5074\u306f<\/span><span class=\"err\">\u3001<\/span><span class=\"nx\">\u30d3\u30eb\u30c9\u6642\u306b<\/span><span class=\"err\">\u3001<\/span><span class=\"nx\">\u81ea\u52d5\u7684\u306b<\/span> <span class=\"p\">.<\/span><span class=\"nx\">cpp<\/span> <span class=\"nx\">\u3092\u306a\u3081\u3066<\/span><span class=\"err\">\u3001<\/span><span class=\"nx\">shim<\/span><span class=\"p\">.<\/span><span class=\"nx\">d<\/span><span class=\"p\">.<\/span><span class=\"nx\">ts<\/span> <span class=\"nx\">\u306a\u308b\u4e2d\u9593\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u751f\u6210\u3057\u3066\u304f\u308c\u308b<\/span><span class=\"err\">\u3002<\/span>\r\n\r\n<span class=\"nx\">\u305d\u306e\u3068\u304d\u306e\u81ea\u52d5\u751f\u6210\u304c<\/span><span class=\"err\">\u3001<\/span><span class=\"k\">export<\/span> <span class=\"nx\">\u3064\u3044\u3066\u306a\u3044\u304b\u3089<\/span><span class=\"err\">\u3001<\/span><span class=\"nx\">\u304a\u304b\u3057\u304b\u3063\u305f\u308a\u3059\u308b\u306e\u304b\u306a\u3068\u601d\u3044\u3064\u3064<\/span><span class=\"err\">\u3002<\/span><span class=\"nx\">\u8abf\u67fb\u3057\u304d\u3063\u3066\u3044\u306a\u3044<\/span><span class=\"err\">\u3002<\/span>\r\n\r\n<span class=\"s2\">```typescript\r\n\/**\r\n* this is hoge\r\n*\/\r\n\/\/% blockId=hoge\r\n\/\/% block=\"Hoge\"\r\n\/\/% block.loc.ja=\"\u307b\u3052\"\r\n\/\/% weight=10 blockGap=8 shim=hogehoge::hoge\r\nfunction hoge(): void;\r\n<\/span><\/code><\/pre>\n<p>\u800c\u4e14\uff0c\u5982\u679c\u4f7f\u7528MakeCode\u7684\u8bdd\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u627e\u4e0d\u5230\u5c5e\u6027\u4e4b\u7c7b\u7684\u9519\u8bef\uff0c\u9677\u5165\u56f0\u5883\u3002<\/p>\n<p>\u65e0\u6cd5\u8bfb\u53d6\u672a\u5b9a\u4e49\u7684\u5c5e\u6027&#8217;hoge&#8217;\u3002<\/p>\n<p>\u5728\u6a21\u62df\u5668\u4e2d\uff0c\u7279\u522b\u662f\u6ca1\u6709\u7279\u5b9a\u7684\u64cd\u4f5c\u9700\u8981\u6267\u884c\u65f6\uff0c\u53ea\u9700\u5728cpp\u7aef\u521b\u5efa\u4e00\u4e2a\u51fd\u6570\u5e76\u5728\u90a3\u91cc\u6dfb\u52a0\u7c7b\u4f3c\u4e8e\u201cblock\u4fee\u9970\u7b26\u201d\u7684\u6ce8\u91ca\u5373\u53ef\uff0c\u4f46\u5728\u5de5\u4f5c\u671f\u95f4\uff0c\u53ef\u80fd\u4f1a\u7f16\u5199\u6216\u5220\u9664\u4e00\u4e9b\u5c0f\u7684\u8c03\u8bd5\u4ee3\u7801\u3002<\/p>\n<p>\u5728\u90a3\u4e2a\u65f6\u5019\uff0c\u6709\u4e00\u79cd\u60c5\u51b5\u662f\u5982\u679c\u7a7a\u7684\u51fd\u6570\u4fdd\u6301\u4e0d\u53d8\uff0c\u5b83\u4f1a\u51fa\u73b0\u65e0\u6cd5\u8fd0\u884c\u7684\u60c5\u51b5\uff0c\u5bfc\u81f4\u975e\u5e38\u56f0\u6270\u3002<\/p>\n<p>\u9519\u8bef TS2384\uff1a\u91cd\u8f7d\u7684\u7b7e\u540d\u5fc5\u987b\u5168\u90e8\u662f\u73af\u5883\u58f0\u660e\u6216\u975e\u73af\u5883\u58f0\u660e\u7684\u3002<\/p>\n<p>\u5f53\u5728makecode\u7684console.log\u4e2d\u65f6\uff0c\u8fd9\u4e9b\u91cd\u590d\u5b9a\u4e49\u7684\u5730\u65b9\u611f\u89c9\u6709\u4e9b\u5947\u602a\u3002\uff08\u4f3c\u4e4e\u5728.ts\u4e2d\u58f0\u660e\u7684\u51fd\u6570\u4e0e\u7531.cpp\u81ea\u52a8\u751f\u6210\u7684.ts\u53d1\u751f\u4e86\u51b2\u7a81\uff09<\/p>\n<h3>\u53e6\u5916\u4e00\u4e2a\u91cd\u8981\u7684\u8981\u70b9\u662f\u3002<\/h3>\n<p>\u5728TypeScript\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5728block\u4fee\u9970\u7b26\u524d\u52a0\u4e0acpp\u6765\u4e3a\u5176\u63d0\u4f9b\u4e00\u4e2a\u540c\u540d\u7684Function\uff0c\u5e76\u4e14\u53ea\u9700\u8981\u4f7f\u7528\/\/%\u6765\u5b8c\u6210block\u4fee\u9970\u7b26\u7684\u5904\u7406\u7684\u60c5\u51b5\u662f\u5b58\u5728\u7684\u3002<\/p>\n<p>\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u5728cpp\u4ee3\u7801\u4e2d\u4ed4\u7ec6\u6dfb\u52a0\u6ce8\u91ca\uff0c\u5c31\u4f1a\u51fa\u73b0\u65e0\u6cd5\u8fd0\u884c\u7684\u95ee\u9898\u3002\u4ee3\u7801\u53ef\u4ee5\u6210\u529f\u7f16\u8bd1\uff0c\u4f46\u4f7f\u7528makecode\u65e0\u6cd5\u8fd0\u884c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"cm\">\/**\r\n* this is hoge\r\n*\/<\/span>\r\n<span class=\"c1\">\/\/%<\/span>\r\n<span class=\"kt\">void<\/span> <span class=\"nf\">hoge<\/span><span class=\"p\">()<\/span> <span class=\"p\">{<\/span>        \r\n    <span class=\"p\">...<\/span>\r\n<span class=\"p\">}<\/span>  \r\n\r\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u8fd0\u884c\u4e86\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c1\">\/\/%<\/span>\r\n<span class=\"kt\">void<\/span> <span class=\"nf\">hoge<\/span><span class=\"p\">()<\/span> <span class=\"p\">{<\/span>        \r\n    <span class=\"p\">...<\/span>\r\n<span class=\"p\">}<\/span>  \r\n\r\n<\/code><\/pre>\n<p>\u6211\u88ab\u6700\u65b0\u7248\u672c\u7684PXT\u751f\u6210\u5668\u8ff7\u4f4f\u4e86\uff0c\u5c3d\u7ba1\u5b83\u53ef\u80fd\u5b58\u5728\u4e00\u4e9bbug\uff0c\u4f46\u8bf7\u6ce8\u610f\uff0c\u56e0\u4e3a\u6211\u6df1\u6df1\u5730\u88ab\u5438\u5f15\u4e86\u3002<\/p>\n<h2>\u8bb0\u5f55<\/h2>\n<p>\u5317\u6b27\u7684SDK\u611f\u89c9\u5df2\u7ecf\u96c6\u6210\u4e8616\u7248\u672c\u7684\u5185\u5bb9\u3002<\/p>\n<p>nrf52833: nrf52833<\/p>\n<p>Softdevice\u5206\u4e3aS113\uff08\u53ef\u80fd\u662f\u9002\u7528\u4e8emicro:bit v1\u7684\u7248\u672c\uff09\u548cS140\uff08\u9002\u7528\u4e8ev2\u7248\u672c\uff09\u3002<br \/>\nhttps:\/\/files.seeedstudio.com\/products\/102991374\/BBC-microbit-v2-datasheet-v1.2.pdf<\/p>\n<p>\u4e0d\u6653\u5f97\u4e3a\u4f55\uff0c\u641c\u7d22\u4e86\u4e00\u4e0bcodal-microbit-nrf5sdk\u4e4b\u7c7b\u7684\u4e1c\u897f\uff0c\u53d1\u73b0S140\u88ab\u5f15\u5165\u4e86\uff0c\u4f46\u662f\u5374\u6ca1\u6709\u88ab\u4f7f\u7528\u7684\u8ff9\u8c61\u3002\u662f\u5426\u662f\u5728\u4f7f\u7528S113\uff1f\u9700\u8981\u786e\u8ba4\u4e00\u4e0b\u3002<\/p>\n<p>https:\/\/github.com\/microbit-foundation\/codal-microbit-nrf5sdk<br \/>\nhttps:\/\/github.com\/microbit-foundation\/codal-microbit-nrf5sdk\/commit\/b2fe152660abf0e99ed4ec3281042003237283f9<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e24\u4e2aGitHub\u94fe\u63a5\uff1a<br \/>\nhttps:\/\/github.com\/microbit-foundation\/codal-microbit-nrf5sdk<br \/>\nhttps:\/\/github.com\/microbit-foundation\/codal-microbit-nrf5sdk\/commit\/b2fe152660abf0e99ed4ec3281042003237283f9<\/p>\n<h2>\u6211\u5f88\u4e0d\u660e\u767d\uff0c\u53ef\u5c31\u50cf\u4e2a\u5927\u7599\u7629\u3002<\/h2>\n<p>\u521b\u5efa\u540d\u4e3apxt\u7684conda\u73af\u5883\uff0c\u4f7f\u7528Python 2.7\u7248\u672c\u3002<br \/>\n\u6fc0\u6d3bpxt\u73af\u5883\u3002<\/p>\n<p>\u4f7f\u7528conda\u547d\u4ee4\uff0c\u901a\u8fc7conda-forge\u6e20\u9053\u5b89\u88c5nodejs\u3002<\/p>\n<p>pxt \u6240\u9700\u7684 Node \u7248\u672c\u4e3a 8.9.4 \u6216\u66f4\u9ad8\u7248\u672c\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4e0e\u4e3b\u8981\u7248\u672c\u5339\u914d\uff0c\u4f46\u8fd8\u662f\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u3002\u76ee\u524d\u6700\u65b0\u7248\u672c\u4e3a 15.3.0\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728 conda-forge \u4ed3\u5e93\u4e2d\u641c\u7d22 nodejs\uff0c\u6765\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<p>\u8bf7\u5378\u8f7dconda-forge\u4e0a\u7684nodejs\uff1a<br \/>\nconda uninstall -c conda-forge nodejs<\/p>\n<p>\u4f7f\u7528conda\u5b89\u88c5Node.js<br \/>\n\u7248\u672c\u5df2\u66f4\u65b0\u4e3a10.13.0<\/p>\n<p>\u968f\u540e\uff0c\u7531\u4e8e\u6000\u7591v10\u7cfb\u5217\u5b58\u5728\u95ee\u9898\uff0c\u6211\u51b3\u5b9a\u5207\u6362\u5230\u63a8\u8350\u4f7f\u7528\u7684v8.9.4\u7248\u672c\u53ca\u66f4\u9ad8\u7248\u672c\u3002<\/p>\n<p>conda\u5378\u8f7dNode.js<\/p>\n<p>\u505a<\/p>\n<p>\u8bf7\u4f7f\u7528conda\u5b89\u88c5Node.js\u7248\u672c\u4e3a8\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u76f4\u52308.9.3\u4e3a\u6b62\u3002<\/p>\n<p>\u5728\u4e2d\u56fd\u672c\u5730\u53ea\u9700\u8981\u4e00\u79cd\u9009\u9879\uff0c\u8bf7\u5c06\u4ee5\u4e0b\u5185\u5bb9\u7528\u4e2d\u6587\u539f\u751f\u65b9\u5f0f\u6539\u8ff0\uff1a\u201cconda install -c conda-forge nodejs=8\u201d\u3002<\/p>\n<p>\u90a3\u4e48\uff0c8.10.0<\/p>\n<p>\u8fdb\u5c55\u987a\u5229\u3002\u4f46\u662f\uff0cnpm\u5b89\u88c5\u65f6\u51fa\u73b0\u4e86\u4e00\u4e9b\u53ef\u7591\u7684msvs\u4f9d\u8d56\u95ee\u9898\u3002<br \/>\n\u53ef\u4ee5\u5c1d\u8bd5\u4e0d\u540c\u7684\u7248\u672c\uff0c\u5305\u62ec\u6dfb\u52a0Microsoft Build Tools 2015\u7b49\u7b49\u3002<\/p>\n<p>\u5b89\u88c5\u4e0e webusb \u76f8\u5173\u7684\u6587\u4ef6<\/p>\n<p>\u8fdb\u5165 `pxt-microbit` \u76ee\u5f55\uff0c\u4f7f\u7528\u547d\u4ee4 `pxt npminstallnative` \u8fdb\u884c\u672c\u5730\u5b89\u88c5\u3002<\/p>\n<blockquote><p>pxt\u9690\u85cf\u4e86\u8fd9\u4e2a\u4fe1\u606f\u3002<br \/>\n\u4f7f\u7528 yotta \u6784\u5efa\u5f15\u64ce\u7684\u76ee\u6807\u662f microbit\u3002<br \/>\n\u76ee\u6807\u7248\u672c\uff1av3.0.61\uff0c\u8def\u5f84\u4e3a C:\\Users\\hisayan\\Downloads\\pxt-microbit\u3002<br \/>\npxt-core \u7248\u672c\uff1av6.0.35\uff0c\u8def\u5f84\u4e3a C:\\Users\\hisayan\\Downloads\\pxt-microbit\\node_modules\\pxt-core\u3002<br \/>\n\u52a0\u8f7d&#8221;webusb&#8221;\u5305\u5931\u8d25\uff0c\u8bf7\u8fd0\u884c\u201cpxt npminstallnative\u201d\u6765\u5b89\u88c5\u672c\u5730\u4f9d\u8d56\u3002<br \/>\n\u5185\u90e8\u9519\u8bef\uff1aTypeError: \u65e0\u6cd5\u8bfb\u53d6\u672a\u5b9a\u4e49\u5c5e\u6027 &#8216;USBAdapter&#8217;\u3002<\/p><\/blockquote>\n<p>PXT_USE_HID=9796990b \u4e2d pxt hiddmesg<\/p>\n<p>pxt-microbit\/libs\/core\/dal.d.ts<br \/>\nMICROBIT_DMESG_LEVEL = MICROBIT_DMESG_LEVEL_DEBUG<\/p>\n<p>pxt-microbit\/libs\/core\/dal.d.ts<br \/>\nMICROBIT_DMESG_LEVEL is set to MICROBIT_DMESG_LEVEL_DEBUG.<\/p>\n<h2>\u6700\u5f8c\u6765\u70b9\u5ba3\u4f20<\/h2>\n<p>\u4e0d\u4ec5\u4ec5\u9650\u4e8emicro:bit\uff0c\u6211\u64c5\u957f\u4e8e\u5b8c\u5168\u6539\u9020scratch\uff0c\u5236\u4f5cNode-RED\u7684\u6a21\u5757\u7b49\u3002\u5982\u679c\u6709\u8fd9\u6837\u7684\u9879\u76ee\uff0c\u8bf7\u968f\u65f6\u4e0e\u6211\u8fdb\u884c\u8be6\u7ec6\u7684\u5de5\u4f5c\u548c\u54a8\u8be2\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fae\u578b\u7f16\u7a0b\u63a7\u5236\u5668Micro:bit\u57282020\u5e7411\u6708\u672b\u8fdb\u884c\u4e86\u5347\u7ea7\u3002 \u56e0\u4e3a\u4ee5\u524d\u505a\u7684\u67d0\u4e2a\u6269\u5c55\u53ef\u80fd\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff0c\u6240\u4ee5\u6211 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-32603","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd - Blog - Silicon Cloud<\/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:\/\/www.silicloud.com\/zh\/blog\/\u8bd5\u7740\u4f7f\u7528microbit-v2-makecode-v3\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd\" \/>\n<meta property=\"og:description\" content=\"\u5fae\u578b\u7f16\u7a0b\u63a7\u5236\u5668Micro:bit\u57282020\u5e7411\u6708\u672b\u8fdb\u884c\u4e86\u5347\u7ea7\u3002 \u56e0\u4e3a\u4ee5\u524d\u505a\u7684\u67d0\u4e2a\u6269\u5c55\u53ef\u80fd\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff0c\u6240\u4ee5\u6211 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u8bd5\u7740\u4f7f\u7528microbit-v2-makecode-v3\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-26T21:12:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T19:27:15+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/\",\"name\":\"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-07-26T21:12:20+00:00\",\"dateModified\":\"2024-04-29T19:27:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd - Blog - Silicon Cloud","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:\/\/www.silicloud.com\/zh\/blog\/\u8bd5\u7740\u4f7f\u7528microbit-v2-makecode-v3\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd","og_description":"\u5fae\u578b\u7f16\u7a0b\u63a7\u5236\u5668Micro:bit\u57282020\u5e7411\u6708\u672b\u8fdb\u884c\u4e86\u5347\u7ea7\u3002 \u56e0\u4e3a\u4ee5\u524d\u505a\u7684\u67d0\u4e2a\u6269\u5c55\u53ef\u80fd\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff0c\u6240\u4ee5\u6211 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u8bd5\u7740\u4f7f\u7528microbit-v2-makecode-v3\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-07-26T21:12:20+00:00","article_modified_time":"2024-04-29T19:27:15+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/","name":"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-07-26T21:12:20+00:00","dateModified":"2024-04-29T19:27:15+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u8bd5\u7740\u4f7f\u7528micro:bit v2 (makecode v3)\u6765\u521b\u5efa\u6269\u5c55\u529f\u80fd"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e8%af%95%e7%9d%80%e4%bd%bf%e7%94%a8microbit-v2-makecode-v3%e6%9d%a5%e5%88%9b%e5%bb%ba%e6%89%a9%e5%b1%95%e5%8a%9f%e8%83%bd%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/32603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=32603"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/32603\/revisions"}],"predecessor-version":[{"id":89402,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/32603\/revisions\/89402"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=32603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=32603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=32603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}