You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 23, 2021. It is now read-only.
-[Download the latest version of the Adafruit CPX library](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries)
80
80
81
-
### How to use
82
-
83
-
To use Device Simulator Express, install the extension from the marketplace and reload VS Code.
84
-
85
-
#### I. Take a look at the "Device Simulator Express: Getting Started" Command.
86
-
1. Type in `"Device Simulator Express: [Circuit Playground Express] New File"` in the command palette (`CTRL + SHIFT + P` / `CMD + SHIFT + P` to open the command palette).
3. Read, copy and learn some of the things you can do with the simulator!
90
-
91
-
#### II. Start with the "Device Simulator Express [Circuit Playground Express]: New File" Command.
92
-
93
-
1. Type in `"Device Simulator Express: [Circuit Playground Express] New File"` in the command palette (`CTRL + SHIFT + P` / `CMD + SHIFT + P` to open the command palette).
2. Name and save your file somewhere, and we’re good to go!
96
-
3. Start with some examples: you can find examples files and tutorials inside the comments, as well as in the notification pop up when you run the `"Device Simulator Express: [Circuit Playground Express] New File"` Command.
97
-
98
-
#### III. Start from an existing Python file.
99
-
100
-
1. Open the folder or your .py file in Visual Studio Code.
101
-
2. Run `Device Simulator Express: [Circuit Playground Express] Open Simulator` from the command palette or icon in the editor toolbar.
102
-
103
-
#### IV. Run your code on the simulator.
104
-
105
-
<imgalt='How to run the CPX simulator animation'src='https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/cpx/cpx-run.gif'>
106
-
107
-
1. Run `Run Simulator` from the command palette or use the `Play` button on the simulator webview.
108
-
109
-
#### V. Deploy your code to the physical device
110
-
111
-
Before deploying the Python code to your CPX device, you need to format your device by following these tutorials:
112
-
113
-
1. Download the firmware with the .uf2 file (link: https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart).
114
-
2. Download the lastest version of the cpx library (link: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).
115
-
116
-
<imgalt='Deploy to CPX Device'src='https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/cpx/cpx-deploy.png'>
117
-
118
-
#### VI. Use the Serial Monitor for your Adafruit CPX device (available on Windows and Mac only)
119
-
120
-
1. Plug in your CPX device (make sure it’s formatted properly already).
121
-
2. Run the command `"Device Simulator Express: Open Serial Monitor"`.
122
-
3. Select your baud rate for the serial port.
123
-
4. The `print()` statements in your code will show in the output console.
124
-
125
-
#### VII. Use the sensors in the Device Simulator Express
126
-
127
-
Generating input for the sensors can be done by interacting directly with device on the webview
128
-
or by using the toolbar.
129
-
130
-
-**Switch, push buttons and capacitive touch:** click directly on the corresponding element on the device or use the keybindings.
131
-
-**Temperature sensor, Light sensor, Acceleration sensor:** click on the corresponding button in the toolbar and change the value using the slider or the input box attached to it.
132
-
-**Shake detection:** go to the motion sensor section in the toolbar and click on the shake button.
133
-
134
-
#### VIII. Debug your project on the simulator
135
-
136
-
1. Add breakpoints in your code
137
-
2. Press F5 to enter the debugging mode, and you can start debugging line by line!
138
-
139
-
### Commands
140
-
141
-
Device Simulator Express provides several commands in the Command Palette (`F1` or `CTRL + SHIFT + P` / `CMD + SHIFT + P` for Mac OS) for working with \*.py files:
142
-
143
-
-`Device Simulator Express: Getting Started`: Opens a page in VS Code that helps users get started with the extension. Here, users can browse through code that they can use to play with the simulators.
144
-
-`Device Simulator Express: Run Simulator`: Runs Python code on the simulator.
145
-
-`Device Simulator Express: [Circuit Playground Express] New File`: Opens an unsaved .py file with template code, also opens the simulator.
146
-
-`Device Simulator Express: [Circuit Playground Express] Open Simulator`: Opens the simulator in the webView
147
-
-`Device Simulator Express: [Circuit Playground Express] Deploy to Device`: Copies the current file to CIRCUITPY drive if detected a CPX is plugged in.
148
-
-`Device Simulator Express: Open Serial Monitor`: Opens the serial monitor in the integrated output window.
149
-
-`Device Simulator Express: Close Serial Monitor`: Stops the serial monitor and releases the serial port.
150
-
-`Device Simulator Express: Change Baud Rate`: Changes the baud rate of the selected serial port. For Adafruit CPX, the default baud rate is 115200.
151
-
-`Device Simulator Express: Select Serial Port`: Changes the current serial port.
152
-
153
81
### Keybindings
154
82
155
83
In Device Simulator Express, you can use keyboard to interact with the device:
@@ -172,82 +100,92 @@ In Device Simulator Express, you can use keyboard to interact with the device:
172
100
- 25 LEDs
173
101
- Light sensor
174
102
- Motion sensors
175
-
- Acceleration detection
103
+
- Acceleration detection including gesture detection
-[BBC micro:bit examples on the official micro:bit website](https://microbit.org/projects/make-it-code-it/?filters=python)
182
110
183
-
### How to use
111
+
### Keybindings
112
+
- Push Button `A for A, B for B, C for A & B`
113
+
- Refresh the simulator: `SHIFT + R`
114
+
- Run the simulator: `SHIFT + F`
115
+
116
+
## How to use
184
117
185
-
#### I. Take a look at the "Device Simulator Express: Getting Started" Command.
186
-
1. Type in `"Device Simulator Express: [Circuit Playground Express] New File"` in the command palette (`CTRL + SHIFT + P` / `CMD + SHIFT + P` to open the command palette).
2. Choose the `micro:bit` option from the dropdown.
118
+
To use Device Simulator Express, install the extension from the marketplace and reload VS Code.
119
+
120
+
### I. Take a look at the "Device Simulator Express: Getting Started" Command.
121
+
1. Type in `"Device Simulator Express: Getting Started"` in the command palette (`CTRL + SHIFT + P` / `CMD + SHIFT + P` to open the command palette).
122
+
2. Choose the the device you want to play with from the dropdown.
189
123
3. Read, copy and learn some of the things you can do with the simulator!
190
-
191
-
#### II. Start with the "Device Simulator Express [micro:bit]: New File" Command.
192
124
193
-
1. Type in `"Device Simulator Express: [micro:bit] New File"` in the command palette (`CTRL + SHFT + P / CMD + SHIFT + P` to open the command palette).
1. Open the folder or your .py file in Visual Studio Code.
200
-
2. Run `Device Simulator Express: [micro:bit] Open Simulator` from the command palette or icon in the editor toolbar.
135
+
### III. Start from an existing Python file.
201
136
202
-
#### IV. Run your code on the simulator.
137
+
1. Open the folder or your .py file in Visual Studio Code.
138
+
2. Run `Device Simulator Express: Open Simulator` from the command palette or icon in the editor toolbar.
139
+
3. Select the device you want to use.
203
140
204
-
<imgalt='How to run the micro:bit simulator animation'src='https://github.com/raw/microsoft/vscode-python-devicesimulator/dev/assets/readmeFiles/microbit/microbit-run.gif'>
141
+
### IV. Run your code on the simulator.
205
142
206
143
1. Run `Run Simulator` from the command palette or use the `Play` button on the simulator webview.
207
144
208
-
#### V. Deploy your code to the physical device
145
+
<imgalt='How to run the simulator animation'src='assets/readmeFiles/run.gif'>
209
146
210
-
1. Run `[micro:bit] Deploy to Device` from the command palette
147
+
### V. Deploy your code to the physical device
211
148
212
-
<imgalt='Deploy to micro:bit device'src='https://github.com/microsoft/vscode-python-devicesimulator/blob/dev/assets/readmeFiles/microbit/microbit-deploy.png'>
149
+
Before deploying the Python code to your CPX device, you need to format your device by following these tutorials:
213
150
214
-
#### VI. Use the Serial Monitor for your BBC micro:bit device (available on Windows and Mac only)
151
+
-*For the CPX*:
152
+
- Download the firmware with the .uf2 file (link: https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart).
153
+
- Download the lastest versions of the cpx libraries (link: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).
215
154
216
-
1. Plug in your BBC micro:bit.
217
-
2. Run the command `"Device Simulator Express: Open Serial Monitor"`.
218
-
3. Select your baud rate for the serial port.
219
-
4. The `print()` statements in your code will show in the output console.
155
+
-*For the micro:bit*:
156
+
- Download the firmware with the .hex file (link: https://microbit.org/get-started/user-guide/firmware/).
220
157
221
-
#### VII. Use the sensors in the Device Simulator Express
158
+
1. Plug in your device (make sure it’s formatted properly already).
159
+
2. Run the command `"Device Simulator Express: Deploy to Device"`.
222
160
223
-
Generating input for the sensors can be done by interacting directly with device on the webview
224
-
or by using the toolbar.
161
+
<imgalt='Deploy to Device'src='assets/readmeFiles/deploy.png'>
225
162
226
-
-**Push buttons:** click directly on the buttons on the device or use the keybindings.
227
-
-**Temperature sensor, Light sensor, Acceleration sensor:** click on the corresponding button in the toolbar and change the value using the slider or the input box attached to it.
163
+
### VI. Use the Serial Monitor for your device (available on Windows and Mac only)
164
+
165
+
1. Plug in your device (make sure it’s formatted properly already).
166
+
2. Run the command `"Device Simulator Express: Open Serial Monitor"`.
167
+
3. Select your baud rate for the serial port.
168
+
4. The `print()` statements in your code will show in the output console.
228
169
229
-
#### VIII. Debug your project on the simulator
170
+
###VII. Debug your project on the simulator
230
171
231
172
1. Add breakpoints in your code
232
173
2. Press F5 to enter the debugging mode, and you can start debugging line by line!
233
174
234
175
### Commands
235
-
Using the simulator for the micro:bit is similar to using the one for the CPX. The only difference is that the commands in the command palette display `Device Simulator Express: [micro:bit] <command>` instead of `Device Simulator Express: [Circuit Playground Express] <command>`. Currently, we support the following commands for micro:bit:
176
+
177
+
Device Simulator Express provides several commands in the Command Palette (`F1` or `CTRL + SHIFT + P` / `CMD + SHIFT + P` for Mac OS) for working with \*.py files:
178
+
236
179
-`Device Simulator Express: Getting Started`: Opens a page in VS Code that helps users get started with the extension. Here, users can browse through code that they can use to play with the simulators.
237
180
-`Device Simulator Express: Run Simulator`: Runs Python code on the simulator.
238
-
-`Device Simulator Express: [micro:bit] Open Simulator`: Opens an unsaved .py file with template code, also opens the simulator.
239
-
-`Device Simulator Express: [micro:bit] New File`: Opens the simulator in the webView.
240
-
-`Device Simulator Express: [micro:bit] Deploy to Device`: Copies the current file to the micro:bit if the device is detected.
181
+
-`Device Simulator Express: New File`: Opens an unsaved .py file with template code, also opens the simulator for the selected device.
182
+
-`Device Simulator Express: Open Simulator`: Opens the simulator in the simulator window for the selected device
183
+
-`Device Simulator Express: Deploy to Device`: Copies the current file to the selected device.
241
184
-`Device Simulator Express: Open Serial Monitor`: Opens the serial monitor in the integrated output window.
242
185
-`Device Simulator Express: Close Serial Monitor`: Stops the serial monitor and releases the serial port.
243
-
-`Device Simulator Express: Change Baud Rate`: Changes the baud rate of the selected serial port. For BBC micro:bit, the default baud rate is 115200.
186
+
-`Device Simulator Express: Change Baud Rate`: Changes the baud rate of the selected serial port. For Adafruit CPX, the default baud rate is 115200.
244
187
-`Device Simulator Express: Select Serial Port`: Changes the current serial port.
245
188
246
-
### Keybindings
247
-
- Push Button `A for A, B for B, C for A & B`
248
-
- Refresh the simulator: `SHIFT + R`
249
-
- Run the simulator: `SHIFT + F`
250
-
251
189
## Contribute
252
190
[See here for steps to run the extension locally.](https://github.com/microsoft/vscode-python-devicesimulator/blob/dev/docs/developers-setup.md)
Copy file name to clipboardExpand all lines: locales/en/out/constants.i18n.json
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,8 @@
14
14
"error.debuggerServerInitFailed": "Warning : The Debugger Server cannot be opened. Please try to free the port {0} if it's already in use or select another one in your Settings 'Device Simulator Express: Debugger Server Port' and start another debug session.\n You can still debug your code but you won't be able to use the Simulator.",
15
15
"error.debuggingSessionInProgress": "[ERROR] A debugging session is currently in progress, please stop it before running your code. \n",
16
16
"error.noDevice": "No plugged in boards detected. Please double check if your board is connected and/or properly formatted",
17
-
"error.noFileToRun": "\n[ERROR] We can't find the .py file to run on simulator. Open up a new .py file, or browse through some examples\n",
17
+
"error.noFileToRun": "\n[ERROR] We can't find the .py file to run. Open up a new .py file, or browse through some examples\n",
18
+
"error.noFileToDeploy": "\n[ERROR] We can't find a Python file to deploy to your device.\n",
18
19
"error.noFolderCreated": "In order to use the Serial Monitor, you need to open a folder and reload VS Code.",
19
20
"error.noProgramFoundDebug": "Cannot find a program to debug.",
20
21
"error.noPythonPath": "We found that you don't have Python 3 installed on your computer, please install the latest version, add it to your PATH and try again.",
@@ -28,6 +29,9 @@
28
29
"info.installPythonDependencies": "Do you want us to try and install this extensions dependencies for you?",
29
30
"error.invalidFileExtensionDebug": "The file you tried to run isn\\'t a Python file.",
30
31
"info.newFile": "New to Python or the Circuit Playground Express? We are here to help!",
32
+
"info.noDeviceChosenToDeployTo": "\n[INFO] No device was selected to deploy to.\n",
33
+
"info.noDeviceChosenToSimulateTo": "\n[INFO] No device was selected to simulate.\n",
34
+
"info.noDeviceChosenForNewFile": "\n[INFO] No device was selected to open a template file for.\n",
"deviceSimulatorExpressExtension.configuration.properties.configEnvOnChange": "When you change the Python interpreter, the Device Simulator Express will automatically configure itself for the required dependencies.",
20
15
"deviceSimulatorExpressExtension.configuration.properties.debuggerPort": "The port the Server will listen on for communication with the debugger.",
0 commit comments