8000 micropython.js/CLI.md at ab3070fed89a86ea4fb8374f34bfa7698ef66ea9 · arduino/micropython.js · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"examples","path":"examples","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"CLI.md","path":"CLI.md","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"TESTS.md","path":"TESTS.md","contentType":"file"},{"name":"cli.js","path":"cli.js","contentType":"file"},{"name":"micropython.js","path":"micropython.js","contentType":"file"},{"name":"package-lock.json","path":"package-lock.json","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"pyboard.py","path":"pyboard.py","contentType":"file"},{"name":"test.js","path":"test.js","contentType":"file"}],"totalCount":12}},"fileTreeProcessingTime":7.0432619999999995,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":620303643,"defaultBranch":"main","name":"micropython.js","ownerLogin":"arduino","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-03-28T12:25:17.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/379109?v=4","public":true,"private":false,"isOrgOwned":true},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"ab3070fed89a86ea4fb8374f34bfa7698ef66ea9","listCacheKey":"v0:1733826092.0","canEdit":false,"refType":"tree","currentOid":"ab3070fed89a86ea4fb8374f34bfa7698ef66ea9"},"path":"CLI.md","currentUser":null,"blob":{"rawLines":null,"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/arduino/micropython.js/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"CLI.md","displayUrl":"https://github.com/arduino/micropython.js/blob/ab3070fed89a86ea4fb8374f34bfa7698ef66ea9/CLI.md?raw=true","headerInfo":{"blobSize":"3.55 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":null,"isGitLfs":false,"onBranch":false,"shortPath":"9f4f5b4","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Farduino%2Fmicropython.js%2Fblob%2Fab3070fed89a86ea4fb8374f34bfa7698ef66ea9%2FCLI.md","isCSV":false,"isRichtext":true,"toc":[{"level":1,"text":"Command Line Interface","anchor":"command-line-interface","htmlText":"Command Line Interface"},{"level":1,"text":"Usage","anchor":"usage","htmlText":"Usage"},{"level":2,"text":"Examples","anchor":"examples","htmlText":"Examples"},{"level":3,"text":"Listing all available USB ports","anchor":"listing-all-available-usb-ports","htmlText":"Listing all available USB ports"},{"level":3,"text":"Listing files in the board","anchor":"listing-files-in-the-board","htmlText":"Listing files in the board"},{"level":3,"text":"Listing files and folders in the board","anchor":"listing-files-and-folders-in-the-board","htmlText":"Listing files and folders in the board"},{"level":3,"text":"Evaluating a string","anchor":"evaluating-a-string","htmlText":"Evaluating a string"},{"level":3,"text":"Running the code from your disk","anchor":"running-the-code-from-your-disk","htmlText":"Running the code from your disk"},{"level":3,"text":"Uploading a file from your disk to the board","anchor":"uploading-a-file-from-your-disk-to-the-board","htmlText":"Uploading a file from your disk to the board"},{"level":3,"text":"Downloading a file from the board to your disk","anchor":"downloading-a-file-from-the-board-to-your-disk","htmlText":"Downloading a file from the board to your disk"},{"level":3,"text":"Verbose","anchor":"verbose","htmlText":"Verbose"}],"lineInfo":{"truncatedLoc":"239","truncatedSloc":"216"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Markdown","languageID":222,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/arduino/micropython.js/blob/ab3070fed89a86ea4fb8374f34bfa7698ef66ea9/CLI.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/arduino/micropython.js/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/arduino/micropython.js/raw/ab3070fed89a86ea4fb8374f34bfa7698ef66ea9/CLI.md","renderImageOrRaw":false,"richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eCommand Line Interface\u003c/h1\u003e\u003ca id=\"user-content-command-line-interface\" class=\"anchor\" aria-label=\"Permalink: Command Line Interface\" href=\"#command-line-interface\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUsage\u003c/h1\u003e\u003ca id=\"user-content-usage\" class=\"anchor\" aria-label=\"Permalink: Usage\" href=\"#usage\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003e\u003ccode\u003enode cli.js [ARGUMENTS]…\u003c/code\u003e\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003e\u003ccode\u003e--listports\u003c/code\u003e: List available USB ports\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--port /dev/tty\u003c/code\u003e: Specify which port to connect. Required for the options below.\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--listfiles\u003c/code\u003e: List files in the board\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--ilistfiles\u003c/code\u003e: Same as \u003ccode\u003e--listfiles\u003c/code\u003e but with additional information (size, inodes, folder/file, etc...)\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--executestring \"print('watch out for string escaping')”\u003c/code\u003e: Evaluate string\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--executefile filename.py\u003c/code\u003e: Run file from the disk\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--putfile fileA.py fileB.py\u003c/code\u003e: Upload \u003ccode\u003efileA.py\u003c/code\u003e from the disk to board renaming it to \u003ccode\u003efileB.py\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--getfile fileA.py fileB.py\u003c/code\u003e: Download \u003ccode\u003efileA.py\u003c/code\u003e from the board to disk renaming it to \u003ccode\u003efileB.py\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--removefile fileA.py\u003c/code\u003e: Remove \u003ccode\u003efileA.py\u003c/code\u003e from the board\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--removedir foldername\u003c/code\u003e: Remove \u003ccode\u003efoldername\u003c/code\u003e from the board\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003e--verbose\u003c/code\u003e: Prints extra logs\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eExamples\u003c/h2\u003e\u003ca id=\"user-content-examples\" class=\"anchor\" aria-label=\"Permalink: Examples\" href=\"#examples\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eListing all available USB ports\u003c/h3\u003e\u003ca id=\"user-content-listing-all-available-usb-ports\" class=\"anchor\" aria-label=\"Permalink: Listing all available USB ports\" href=\"#listing-all-available-usb-ports\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --listports \navailable ports [\n {\n path: '/dev/ttyACM0',\n manufacturer: 'MicroPython',\n serialNumber: '5031503337360009',\n pnpId: 'usb-MicroPython_Board_in_FS_mode_5031503337360009-if00',\n locationId: undefined,\n vendorId: '2341',\n productId: '025e'\n }\n]\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --listports \navailable ports [\n {\n path: '/dev/ttyACM0',\n manufacturer: 'MicroPython',\n serialNumber: '5031503337360009',\n pnpId: 'usb-MicroPython_Board_in_FS_mode_5031503337360009-if00',\n locationId: undefined,\n vendorId: '2341',\n productId: '025e'\n }\n]\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eListing files in the board\u003c/h3\u003e\u003ca id=\"user-content-listing-files-in-the-board\" class=\"anchor\" aria-label=\"Permalink: Listing files in the board\" href=\"#listing-files-in-the-board\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --port /dev/ttyACM0 --listfiles \nfiles at \u0026quot;/\u0026quot; [\n '.openmv_disk',\n '.fseventsd',\n 'main.py',\n 'midi.py',\n 'boot.py',\n '.Trash-1000',\n 'lib'\n]\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --port /dev/ttyACM0 --listfiles \nfiles at \"/\" [\n '.openmv_disk',\n '.fseventsd',\n 'main.py',\n 'midi.py',\n 'boot.py',\n '.Trash-1000',\n 'lib'\n]\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eListing files and folders in the board\u003c/h3\u003e\u003ca id=\"user-content-listing-files-and-folders-in-the-board\" class=\"anchor\" aria-label=\"Permalink: Listing files and folders in the board\" href=\"#listing-files-and-folders-in-the-board\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eAS explained on the \u003ca href=\"https://docs.micropython.org/en/v1.9.2/pyboard/library/uos.html#uos.ilistdir\" rel=\"nofollow\"\u003edocumentation\u003c/a\u003e, the second element on the array is the file type:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp dir=\"auto\"\u003e0x4000 for directories and 0x8000 for regular files\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --verbose --port /dev/ttyACM0 --ilistfiles\nVERBOSE\nexecuting command:\ncommand --ilistfiles\narguments []\nport /dev/ttyACM0\nfiles at \u0026quot;/\u0026quot; [\n [ 'boot.py', 32768, 0, 1714 ],\n [ '.fseventsd', 16384, 0, 0 ],\n [ 'testy.py', 32768, 0, 78 ],\n [ 'file.py', 32768, 0, 929 ],\n [ 'yolo', 16384, 0, 0 ],\n [ 'lib', 16384, 0, 0 ],\n [ '.Trashes', 16384, 0, 0 ],\n [ 'otroteste.py', 32768, 0, 929 ],\n [ 'turing_machine.py', 32768, 0, 929 ]\n]\ncommand executed --ilistfiles\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --verbose --port /dev/ttyACM0 --ilistfiles\nVERBOSE\nexecuting command:\ncommand --ilistfiles\narguments []\nport /dev/ttyACM0\nfiles at \"/\" [\n [ 'boot.py', 32768, 0, 1714 ],\n [ '.fseventsd', 16384, 0, 0 ],\n [ 'testy.py', 32768, 0, 78 ],\n [ 'file.py', 32768, 0, 929 ],\n [ 'yolo', 16384, 0, 0 ],\n [ 'lib', 16384, 0, 0 ],\n [ '.Trashes', 16384, 0, 0 ],\n [ 'otroteste.py', 32768, 0, 929 ],\n [ 'turing_machine.py', 32768, 0, 929 ]\n]\ncommand executed --ilistfiles\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eEvaluating a string\u003c/h3\u003e\u003ca id=\"user-content-evaluating-a-string\" class=\"anchor\" aria-label=\"Permalink: Evaluating a string\" href=\"#evaluating-a-string\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --port /dev/ttyACM0 --executestring \u0026quot;print('hello world!')\u0026quot;\nOK\nMPY: soft reboot\nraw REPL; CTRL-B to exit\n\u0026gt;OKhello world!\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --port /dev/ttyACM0 --executestring \"print('hello world!')\"\nOK\nMPY: soft reboot\nraw REPL; CTRL-B to exit\n\u0026gt;OKhello world!\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eRunning the code from your disk\u003c/h3\u003e\u003ca id=\"user-content-running-the-code-from-your-disk\" class=\"anchor\" aria-label=\"Permalink: Running the code from your disk\" href=\"#running-the-code-from-your-disk\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --port /dev/ttyACM0 --executefile examples/test.py\nOK\nMPY: soft reboot\nraw REPL; CTRL-B to exit\n\u0026gt;OKstart\nduh\nduh\nduh\nduh\nduh\nduh\nduh\nduh\nduh\nduh\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --port /dev/ttyACM0 --executefile examples/test.py\nOK\nMPY: soft reboot\nraw REPL; CTRL-B to exit\n\u0026gt;OKstart\nduh\nduh\nduh\nduh\nduh\nduh\nduh\nduh\nduh\nduh\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eUploading a file from your disk to the board\u003c/h3\u003e\u003ca id=\"user-content-uploading-a-file-from-your-disk-to-the-board\" class=\"anchor\" aria-label=\"Permalink: Uploading a file from your disk to the board\" href=\"#uploading-a-file-from-your-disk-to-the-board\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --port /dev/ttyACM0 --putfile examples/test.py test.py\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --port /dev/ttyACM0 --putfile examples/test.py test.py\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eDownloading a file from the board to your disk\u003c/h3\u003e\u003ca id=\"user-content-downloading-a-file-from-the-board-to-your-disk\" class=\"anchor\" aria-label=\"Permalink: Downloading a file from the board to your disk\" href=\"#downloading-a-file-from-the-board-to-your-disk\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --port /dev/ttyACM0 --getfile test.py test.py\n\u0026quot;\u0026quot;\u0026quot;\nTest\n\u0026quot;\u0026quot;\u0026quot;\n\nfrom machine import Pin\nfrom time import sleep\npin = Pin(6, Pin.OUT)\nprint(\u0026quot;start\u0026quot;)\nfor i in range(0, 10):\n pin.on()\n sleep(0.1)\n pin.off()\n sleep(0.1)\n print('duh')\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --port /dev/ttyACM0 --getfile test.py test.py\n\"\"\"\nTest\n\"\"\"\n\nfrom machine import Pin\nfrom time import sleep\npin = Pin(6, Pin.OUT)\nprint(\"start\")\nfor i in range(0, 10):\n pin.on()\n sleep(0.1)\n pin.off()\n sleep(0.1)\n print('duh')\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch3 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eVerbose\u003c/h3\u003e\u003ca id=\"user-content-verbose\" class=\"anchor\" aria-label=\"Permalink: Verbose\" href=\"#verbose\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ node cli.js --verbose --port /dev/ttyACM0 --putfile ./savetest.py savetest.py\nVERBOSE\nexecuting command:\ncommand --putfile\narguments [ './savetest.py', 'savetest.py' ]\nport /dev/ttyACM0\n0%\n1%\n2%\n3%\n4%\n5%\n6%\n7%\n8%\n9%\n10%\n12%\n13%\n14%\n15%\n16%\n17%\n18%\n19%\n20%\n21%\n22%\n24%\n25%\n26%\n27%\n28%\n29%\n30%\n31%\n32%\n33%\n35%\n36%\n37%\n38%\n39%\n40%\n41%\n42%\n43%\n44%\n45%\n47%\n48%\n49%\n50%\n51%\n52%\n53%\n54%\n55%\n56%\n57%\n59%\n60%\n61%\n62%\n63%\n64%\n65%\n66%\n67%\n68%\n70%\n71%\n72%\n73%\n74%\n75%\n76%\n77%\n78%\n79%\n80%\n82%\n83%\n84%\n85%\n86%\n87%\n88%\n89%\n90%\n91%\n92%\n94%\n95%\n96%\n97%\n98%\n99%\nundefined\ncommand executed --putfile\"\u003e\u003cpre class=\"notranslate\"\u003e\u003ccode\u003e$ node cli.js --verbose --port /dev/ttyACM0 --putfile ./savetest.py savetest.py\nVERBOSE\nexecuting command:\ncommand --putfile\narguments [ './savetest.py', 'savetest.py' ]\nport /dev/ttyACM0\n0%\n1%\n2%\n3%\n4%\n5%\n6%\n7%\n8%\n9%\n10%\n12%\n13%\n14%\n15%\n16%\n17%\n18%\n19%\n20%\n21%\n22%\n24%\n25%\n26%\n27%\n28%\n29%\n30%\n31%\n32%\n33%\n35%\n36%\n37%\n38%\n39%\n40%\n41%\n42%\n43%\n44%\n45%\n47%\n48%\n49%\n50%\n51%\n52%\n53%\n54%\n55%\n56%\n57%\n59%\n60%\n61%\n62%\n63%\n64%\n65%\n66%\n67%\n68%\n70%\n71%\n72%\n73%\n74%\n75%\n76%\n77%\n78%\n79%\n80%\n82%\n83%\n84%\n85%\n86%\n87%\n88%\n89%\n90%\n91%\n92%\n94%\n95%\n96%\n97%\n98%\n99%\nundefined\ncommand executed --putfile\n\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\n\u003c/article\u003e","renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":"/arduino/.github/blob/832a6cace2303242546f51acf1a267843e828441/FUNDING.yml","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"Command Line Interface","kind":"section_1","ident_start":2,"ident_end":24,"extent_start":0,"extent_end":26,"fully_qualified_name":"Command Line Interface","ident_utf16":{"start":{"line_number":0,"utf16_col":2},"end":{"line_number":0,"utf16_col":24}},"extent_utf16":{"start":{"line_number":0,"utf16_col":0},"end":{"line_number":2,"utf16_col":0}}},{"name":"Usage","kind":"section_1","ident_start":28,"ident_end":33,"extent_start":26,"extent_end":3632,"fully_qualified_name":"Usage","ident_utf16":{"start":{"line_number":2,"utf16_col":2},"end":{"line_number":2,"utf16_col":7}},"extent_utf16":{"start":{"line_number":2,"utf16_col":0},"end":{"line_number":239,"utf16_col":0}}},{"name":"Examples","kind":"section_2","ident_start":836,"ident_end":844,"extent_start":833,"extent_end":3632,"fully_qualified_name":"Examples","ident_utf16":{"start":{"line_number":18,"utf16_col":3},"end":{"line_number":18,"utf16_col":11}},"extent_utf16":{"start":{"line_number":18,"utf16_col":0},"end":{"line_number":239,"utf16_col":0}}},{"name":"Listing all available USB ports","kind":"section_3","ident_start":850,"ident_end":881,"extent_start":846,"extent_end":1231,"fully_qualified_name":"Listing all available USB ports","ident_utf16":{"start":{"line_number":20,"utf16_col":4},"end":{"line_number":20,"utf16_col":35}},"extent_utf16":{"start":{"line_number":20,"utf16_col":0},"end":{"line_number":37,"utf16_col":0}}},{"name":"Listing files in the board","kind":"section_3","ident_start":1235,"ident_end":1261,"extent_start":1231,"extent_end":1461,"fully_qualified_name":"Listing files in the board","ident_utf16":{"start":{"line_number":37,"utf16_col":4},"end":{"line_number":37,"utf16_col":30}},"extent_utf16":{"start":{"line_number":37,"utf16_col":0},"end":{"line_number":52,"utf16_col":0}}},{"name":"Listing files and folders in the board","kind":"section_3","ident_start":1465,"ident_end":1503,"extent_start":1461,"extent_end":2210,"fully_qualified_name":"Listing files and folders in the board","ident_utf16":{"start":{"line_number":52,"utf16_col":4},"end":{"line_number":52,"utf16_col":42}},"extent_utf16":{"start":{"line_number":52,"utf16_col":0},"end":{"line_number":79,"utf16_col":0}}},{"name":"Evaluating a string","kind":"section_3","ident_start":2214,"ident_end":2233,"extent_start":2210,"extent_end":2379,"fully_qualified_name":"Evaluating a string","ident_utf16":{"start":{"line_number":79,"utf16_col":4},"end":{"line_number":79,"utf16_col":23}},"extent_utf16":{"start":{"line_number":79,"utf16_col":0},"end":{"line_number":89,"utf16_col":0}}},{"name":"Running the code from your disk","kind":"section_3","ident_start":2383,"ident_end":2414,"extent_start":2379,"extent_end":2584,"fully_qualified_name":"Running the code from your disk","ident_utf16":{"start":{"line_number":89,"utf16_col":4},"end":{"line_number":89,"utf16_col":35}},"extent_utf16":{"start":{"line_number":89,"utf16_col":0},"end":{"line_number":109,"utf16_col":0}}},{"name":"Uploading a file from your disk to the board","kind":"section_3","ident_start":2588,"ident_end":2632,"extent_start":2584,"extent_end":2712,"fully_qualified_name":"Uploading a file from your disk to the board","ident_utf16":{"start":{"line_number":109,"utf16_col":4},"end":{"line_number":109,"utf16_col":48}},"extent_utf16":{"start":{"line_number":109,"utf16_col":0},"end":{"line_number":115,"utf16_col":0}}},{"name":"Downloading a file from the board to your disk","kind":"section_3","ident_start":2716,"ident_end":2762,"extent_start":2712,"extent_end":3028,"fully_qualified_name":"Downloading a file from the board to your disk","ident_utf16":{"start":{"line_number":115,"utf16_col":4},"end":{"line_number":115,"utf16_col":50}},"extent_utf16":{"start":{"line_number":115,"utf16_col":0},"end":{"line_number":135,"utf16_col":0}}},{"name":"Verbose","kind":"section_3","ident_start":3032,"ident_end":3039,"extent_start":3028,"extent_end":3632,"fully_qualified_name":"Verbose","ident_utf16":{"start":{"line_number":135,"utf16_col":4},"end":{"line_number":135,"utf16_col":11}},"extent_utf16":{"start":{"line_number":135,"utf16_col":0},"end":{"line_number":239,"utf16_col":0}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/arduino/micropython.js/branches":{"post":"PDTJwZWgl4VpgMjMdQNiqHrC8xTJY3g329JuzemUTKX7WtLvhD5sjmXArel50amcwW8UqnmqXg2w5xCRNTrp9g"},"/repos/preferences":{"post":"CxJU90w11xSQTp005ohKZ5Khbnp-jvGgPhip7b2xUUvQaYbIRoNhAmFQR6fcszBGiRU5dsn2m5Dkw_qs-nYChw"}}},"title":"micropython.js/CLI.md at ab3070fed89a86ea4fb8374f34bfa7698ef66ea9 · arduino/micropython.js","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0