{"id":2503,"date":"2023-08-03T23:22:36","date_gmt":"2023-08-03T15:22:36","guid":{"rendered":"https:\/\/104.es\/?p=2503"},"modified":"2023-08-03T23:22:36","modified_gmt":"2023-08-03T15:22:36","slug":"microbit-upload-file","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2023\/08\/03\/microbit-upload-file\/","title":{"rendered":"\u3010micro:bit\u3011\u4e0a\u50b3\u6a94\u6848\u5230micro:bit"},"content":{"rendered":"\n<p>\u5728\u9019\u88e1\u8b1b\u7684\u4e0d\u662f\u628a\u6211\u5011\u7de8\u5beb\u597d\u7684MicroPython\u7a0b\u5f0f\u7de8\u8b6f\u6210HEX\u6a94\u6848\u4e4b\u5f8c\u518d\u4e0a\u50b3\u5230micro:bit\u4e0a\u57f7\u884c\uff0c\u800c\u662f\u628a\u4e00\u4e9b\u5176\u5b83\u7684\u6a94\u6848\uff0c\u5305\u62ec\u7a0b\u5f0f\u6a94\u6848\u3001\u5716\u5f62\u6a94\u6848\u3001\u6216\u662f\u8cc7\u6599\u6a94\u6848\u4e0a\u50b3\u5230micro:bit\u4e0a\u4ee5\u5099\u7a0b\u5f0f\u4e4b\u9700\u3002<\/p>\n\n\n\n<p>\u5728\u4e4b\u524d\u7684\u6559\u5b78\u4e2d\uff0c\u6211\u5011\u505a\u7684\u90fd\u662f\u7de8\u5bebmicro:bit\u677f\u5b50\u4e0a\u552f\u4e00\u8981\u88ab\u57f7\u884c\u7684\u7a0b\u5f0f\u8173\u672c\uff0c\u7136\u800c\uff0c\u5728\u4e00\u4e9b\u7a0b\u5f0f\u57f7\u884c\u7684\u904e\u7a0b\u4e2d\u53ef\u80fd\u6703\u984d\u5916\u7528\u5230\u5176\u5b83\u7684\u8cc7\u6e90\u6a94\u6848\uff0c\u6216\u662f\u5f15\u5165\u5176\u4ed6\u4eba\u5beb\u597d\u7684\u7a0b\u5f0f\u6a21\u7d44\uff0c\u6b64\u6642\u5c31\u9700\u8981\u4ee5\u53e6\u5916\u7684\u65b9\u5f0f\u628a\u9019\u4e9b\u6703\u7528\u5230\u7684\u8cc7\u6e90\u6a94\u3001\u8cc7\u6599\u6a94\u3001\u6216\u662f\u6a21\u7d44\u7a0b\u5f0f\u6a94\u6848\u4e0a\u50b3\u3002\u9019\u4e9b\u6a94\u6848\u53ef\u4ee5\u9078\u64c7\u5728 Mu Editor\u4e2d\u7684\u6a94\u6848\u529f\u80fd\u4f86\u6aa2\u8996\u53ca\u7ba1\u7406\u5728micro:bit\u4e0a\u7684\u6a94\u6848\uff0c\u6216\u662f\u5229\u7528Python\u6a21\u7d44microfs\u4f86\u64cd\u4f5c\u3002\u5148\u4f86\u8aaa\u660e\u5f8c\u8005\uff0c\u9996\u5148\uff0c\u8acb\u5148\u5728\u81ea\u5df1\u7684\u96fb\u8166\u4e2d\u7684Python\u74b0\u5883\u88e1\u57f7\u884c\u4ee5\u4e0b\u7684\u5b89\u88dd\u7a0b\u5e8f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install microfs<\/code><\/pre>\n\n\n\n<p>\u9806\u5229\u5b89\u88dd\u5b8c\u6210\u4e4b\u5f8c\uff0c\u5373\u53ef\u5229\u7528ufs\u6307\u4ee4\u5217\u793a\u51fa\u76ee\u524d\u5728micro:bit\u4e0a\u7684\u6240\u6709\u7684\u6a94\u6848\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ufs ls<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u4f60\u8f38\u5165ufs\u800c\u4e0d\u52a0\u4e0a\u4efb\u4f55\u53c3\u6578\u7684\u8a71\uff0c\u6703\u6709\u5982\u4e0b\u6240\u793a\u7684\u4f7f\u7528\u8aaa\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>c:\\>ufs\r\nusage: ufs &#91;-h] &#91;command] &#91;path] &#91;target]\r\n\r\nInteract with the basic filesystem on a connected BBC micro:bit device. You\r\nmay use the following commands: 'ls' - list files on the device (based on the\r\nequivalent Unix command); 'rm' - remove a named file on the device (based on\r\nthe Unix command); 'put' - copy a named local file onto the device just like\r\nthe FTP command; and, 'get' - copy a named file from the device to the local\r\nfile system a la FTP. For example, 'ufs ls' will list the files on a connected\r\nBBC micro:bit.\r\n\r\npositional arguments:\r\n  command     One of 'ls', 'rm', 'put' or 'get'.\r\n  path        Use when a file needs referencing.\r\n  target      Use to specify a target filename.\r\n\r\noptional arguments:\r\n  -h, --help  show this help message and exit<\/code><\/pre>\n\n\n\n<p>\u5f9e\u4e0a\u9762\u7684\u8aaa\u660e\u53ef\u4ee5\u770b\u5230\uff0c\u5b83\u63d0\u4f9b\u4e86ls\u3001rm\u3001put\u3001\u4ee5\u53caget\u7b49\u56db\u500b\u547d\u4ee4\uff0c\u5176\u4e2d ls\u7528\u4f86\u5217\u51fa\u6240\u6709\u5728micro:bit\u4e0a\u7684\u6a94\u6848\uff1brm\u7528\u4f86\u522a\u9664\u5728micro:bit\u4e0a\u7684\u6a94\u6848\uff1bput\u53ef\u4ee5\u628a\u76ee\u524d\u8cc7\u6599\u593e\u4e2d\u7684\u6a94\u6848\u4e0a\u50b3\u5230micro:bit\uff1bget\u5247\u662f\u628a\u6a94\u6848\u5f9emicro:bit\u4e2d\u53d6\u51fa\u3002\u5047\u8a2d\u6211\u5011\u8981\u4e0a\u50b3\u7684\u6a94\u6848\u540d\u7a31\u662fssd1306.py\uff0c\u5247\u4e0a\u50b3\u7684\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\>ufs put ssd1306.py<\/code><\/pre>\n\n\n\n<p>\u8acb\u7559\u610f\uff0c\u4e0a\u8ff0\u7684\u6307\u4ee4\u4e2d\uff0cC:\\&gt;\u662f\u547d\u4ee4\u63d0\u793a\u5b57\u5143\uff0c\u4e0d\u9700\u8981\u8f38\u5165\u5594\u3002<\/p>\n\n\n\n<p>\u53e6\u5916\u4e00\u500b\u64cd\u4f5c micro:bit\u6a94\u6848\u7684\u65b9\u5f0f\u662f\u5229\u7528Mu Editor\u7684File\uff08\u6587\u4ef6\uff09\u529f\u80fd\u3002\u7576\u4f60\u5982\u4e0b\u5716\u7bad\u982d\u6240\u6307\u7684\u5730\u65b9\u6309\u4e0bFile\uff08\u6587\u4ef6\uff09\u6309\u9215\u6642\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"692\" src=\"https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6-1024x692.png\" alt=\"\" class=\"wp-image-2504\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6-1024x692.png 1024w, https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6-300x203.png 300w, https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6-768x519.png 768w, https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6-600x405.png 600w, https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6.png 1337w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728\u7de8\u8f2f\u5668\u7684\u4e0b\u65b9\u5373\u51fa\u73fe\u4e86\u5169\u500b\u984d\u5916\u7684\u8996\u7a97\uff0c\u5de6\u5074\u7684\u5167\u5bb9\u5373\u70bamicro:bit\u4e0a\u9664\u4e86\u4e3b\u7a0b\u5f0f\u4e4b\u5916\u7684\u6a94\u6848\uff0c\u800c\u53f3\u5074\u5247\u662f\u5728\u4f60\u7684\u96fb\u8166\u4e2d\u4f4d\u65bcmu_code\u8cc7\u6599\u593e\u4e4b\u4e0b\u7684\u6240\u6709\u6a94\u6848\uff0c\u4f60\u53ef\u4ee5\u5728\u5169\u500b\u8996\u7a97\u9593\u62d6\u66f3\u6a94\u6848\uff0c\u5373\u53ef\u57f7\u884c\u6a94\u6848\u4e0a\u50b3\u6216\u4e0b\u8f09\u7684\u4f5c\u696d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u9019\u88e1\u8b1b\u7684\u4e0d\u662f\u628a\u6211\u5011\u7de8\u5beb\u597d\u7684MicroPython\u7a0b\u5f0f\u7de8\u8b6f\u6210HEX\u6a94\u6848\u4e4b\u5f8c\u518d\u4e0a\u50b3\u5230micro:bit\u4e0a\u57f7\u884c\uff0c\u800c\u662f\u628a\u4e00\u4e9b\u5176\u5b83\u7684\u6a94\u6848\uff0c\u5305\u62ec\u7a0b\u5f0f\u6a94\u6848\u3001\u5716\u5f62\u6a94\u6848\u3001\u6216\u662f\u8cc7\u6599\u6a94\u6848\u4e0a\u50b3\u5230micro:bit\u4e0a\u4ee5\u5099\u7a0b\u5f0f\u4e4b\u9700\u3002<\/p>\n","protected":false},"author":1,"featured_media":2504,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-2503","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microbit"],"jetpack_featured_media_url":"https:\/\/104.es\/wp-content\/uploads\/2023\/08\/image-6.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/comments?post=2503"}],"version-history":[{"count":1,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2503\/revisions"}],"predecessor-version":[{"id":2505,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2503\/revisions\/2505"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media\/2504"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=2503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=2503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=2503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}