Particle Workbench - Berkeley-MDes/24f-desinv-202 GitHub Wiki
Use this option if you are opening a demo distributed to the student body for our class.
- Open up Visual Studio Code
- Select
File -> Open Folder
- navigate to the folder in question, and “go inside of it” by double-clicking
- click “open”
- In the explorer view, click on the
.cpp
file to expose the particle workbench, so that you can compile and flash
Use this option if you are creating a new project from scratch!
- click on the Particle Workbench extension on the left sidebar of VS code
- scroll down to the area labeled "Code" and click on "Create new project"
- A window will open, prompting you to select a parent folder for the project
- Navigate to the location you want the project to live, and click on blue button
- VS Code will prompt you in the Command Palette to enter a project name
- Type it in, and hit 'Enter'
- VS Code will prompt you to verify that you want to do this; click or select 'ok' and hit 'Enter'
- The project has now been created
Navigate to source code
- In the explorer view on the left, open up the 'src' directory
- click on the file with your project name, as in .cpp
- This will expose the file you are going to use for the project
- You can start to edit the file from the boiler plate code provided, or paste in your own
- To paste in your own, select all (command-a or control-a) and hit backspace or delete, then paste from your clipboard
Clean your workspace
- Sometimes, after many compilations in VS Code (or after moving your files), you need to clean the directory area you're working in. There are two ways to do this:
- VS Code clean (make):
- Click on the notifications button in the bottom-right area of the screen (Bell icon) and located the notification with a message like "Your local abuild appears to be dirty. Clean?"
- Click the [clean] button
- Cleaning can take some time, so please be patient
- Particle Workbench clean:
- type
command-shift-p
to expose the command palette - type
>Particle: clean application & DeviceOS
, then hitenter
- type
- VS Code clean (make):
- At the bottom of VS Code's window, you will see a status bar
- If you have installed Particle Workbench, this will include tabs for the following
- Active Particle [Platform]
- Active [deviceOS Version]
- Your Target [Device] ID/Name
- bring up the command palette with
⇧⌃P (Windows, Linux) | ⇧⌘P (macOS)
- type
>Particle: Configure Project for Device
, and hitenter
- select the OS (5.8.0 as of 9/27/24) and platform
Photon 2 / P2
- regarding the device name/id: you can hit enter to leave this empty
- You are now ready to compile code using the Particle Workbench! Note that after cleaning in a new project context, you should be able to continue to compile repeatedly without cleaning, and that compilation will take far less time.
Connect your device
- Connect your device via USB or to a wifi network
- Once connected, you can start to flash the device with firmware
Edit and compile/flash
- Edit your file (this is the fun stuff!!)
- Compilation can frequently be faster than flashing, so feel free to "check" your code for errors before flashing
- If you are sure that your code is operative, go ahead and skip compilation and flash instead. See this step-by-step tutorial for more details.
- You aren't able to compile and receive a strange error, even though everything seems like it's been set up correctly. This can happen as a result of moving files around, sharing projects between computers, or because you've made significant changes to a project that the Particle Workbench hasn't tracked.
- Solution: Clean your project
- You have installed something new in your shell environment, but you don't see the tools you've recently installed.
- It's possible that you haven't refreshed VS Code by opening up a new Terminal window (which initializes your shell session and includes all of your latest greatest).
- Solution: Open up a new terminal to gain access to your new tools.
- You type
particle serial mac
but you get an error indicating the CLI tools aren't installed.- Solution: You might need to click on the Particle Workbench extension home page, and then click on [Launch CLI] for the first time, which sometimes prompts the workbench to install the command line Particle tools.
- Solution: You might not have the CLI tools installed. Find instructions for that here.
- You haven't set your project up and you try to compile without selecting the correct targets.
- Your compilation process is "taking a long time". This can happen because it's the first time you've attempted to compile, and there is a LOT of stuff that VS Code needs to know about that first time!
- Solution: Please be patient; the subsequent compilations should take less time.
- You are having issues moving between many projects and would like a way to consolidate the workflow as you are learning.
- Solution: In the beginning, you may find it easier to set up a single project to use for a while and just copying in the text of your files so that you have them elsewhere. Once you start compiling more frequently across many projects you'll be generating larger files on disk, so portability decreases. It's also easy to forget to set up your project when you're in a hurry and just need a quick answer about a problem. That said, as long as you're removing your build folders, projects stay pretty small.
- Your Photon2 is blinking and/or communicating strange status modes via colors or blinking patterns.
- Solution: See this page for a troubleshooting guide regarding the main status LED
- Your Photon2 used to belong to someone else and you need to claim it to your account, but receive an error message indicating that the device cannot be imported and that it belongs to someone outside of your organization.
- Solution: You need to have the person who has transferred the photon2 to you do one or more of the following:
- unclaim the device in their Particle.io account
- remove the device from a product they manage in their account
- remove the device from a product that someone else managed, but who added their device to via an email invite in a team context (within the particle cloud)
- Solution: You need to have the person who has transferred the photon2 to you do one or more of the following:
-
particle help
print info regarding the commands collected here for reference (and more) -
particle wifi list
link -
particle serial wifi
link -
particle serial list
link -
particle serial mac
link -
particle identify
link -
particle whoami
Identify your login identity as it relates to the particle cloud in the command line interface. If you are logged in, this will typically be the email associated with the account. -
particle token list
link -
particle update
link -
particle update-cli
Update the Particle CLI to the latest version -
particle usb start-listening
link -
particle usb stop-listening
link -
particle usb dfu
link -
particle usb reset
link particle usb cloud-status
-
particle compile
link -
particle cloud flash
link -
particle flash <id> <dir>
link -
particle flash --local
link -
particle login
link