Running programs

This option makes it easy to quickly execute Toit code once on a device. The device needs to be online since the installation and execution of the code happen synchronously such that you get feedback right away.

Running a program on a device does not allow the device to go into deep sleep since it needs to remain online for the program to run, even if it is set to make a measurement only once a day. Therefore this method of executing code is great for running small snippets of code on a device but not built for running actual long-lived applications.

If you have installed the VSCode Toit extension, you should have a Toit logo in the left-hand menu in VSCode. Clicking this logo will bring up a list of your devices. To run your Toit program, press the play symbol next to the device name.

If your Toit program is open in VSCode, it will run immediately. If not, you will be asked to specify where your file with Toit code is located.

Screenshot VSCode run button
Screenshot VSCode run button

Any print statements in your Toit code will published in the Logs tab for that particular device in the Toit console.