From c3525fdecece9f6bd3230d9852f266561a1410f9 Mon Sep 17 00:00:00 2001 From: Hiroaki Hasegawa Date: Sun, 1 Oct 2023 10:20:46 +0900 Subject: [PATCH] Fix #134, Support stopping execution with VSCode command --- README.md | 13 +++++++++++-- package.json | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f9aec0..675d36f 100755 --- a/README.md +++ b/README.md @@ -60,10 +60,19 @@ pin = Pin("LED", Pin.OUT) print("LED starts flashing...") while True: - pin.toggle() - sleep(1) # sleep 1sec + try: + pin.toggle() + sleep(1) # sleep 1sec + except KeyboardInterrupt: + break +pin.off() +print("Finished.") ``` +- To run your program, run `> MicroPico > Run current file on Pico` in your Python file's tab. You can also use the status bar button "Run " at the bottom of VS Code window. + +- To stop the execution of the currently running program, run `> MicroPico > Stop execution`. The "Stop" button at the status bar does the same. + --- ## Extension Settings diff --git a/package.json b/package.json index 63853d7..852d0ea 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,11 @@ "enablement": "resourceScheme == pico && isFileSystemResource && resourceExtname == .py", "category": "MicroPico" }, + { + "command": "micropico.universalStop", + "title": "Stop execution", + "category": "MicroPico" + }, { "command": "micropico.runselection", "title": "Run current selection on Pico",