Toit is a modern high-level language designed specifically for microcontrollers
Toit is optimised for live reloading on your microcontroller. Your code runs incrementally as you write it and you get instant feedback. Push changes over your local WiFi in two seconds and reserve your USB cable for charging your phone. You iterate quickly, learn fast, and build better things.
Hello, world!
Everyone likes to start with a simple program, so here is the obligatory "Hello, world!" program in Toit. Define your main function by writing its name, followed by a colon. The body of the function is indented by two spaces. The "print" function takes one argument - you don't need parentheses.
Learn more...main:
print "Hello, World!"
Toit + Jaguar = 🥳
Jaguar is a small application developed by the Toit team, that runs on your ESP32. It enables live reloading and lets you update and restart your ESP32 code over WiFi.
Update your code and restart your ESP32 conveniently over WiFi. No need to flash over serial, reboot your device, or wait for it to reconnect to your network.
Change your code in your editor, update it on your device, and restart it all within seconds.
Updates contain compiled Toit programs that are relocated and installed in flash on the device. Old versions are stopped and their resources are freed automatically.
No ESP32?
The Toit language can also be used on the desktop. In fact, we use it to develop many of the tools that come with the SDK.
Documentation
Learn how to code with Toit and how you can use it in your IoT projects.
Latest news
Toit v2.0.0-alpha.146 release Apr. 22nd, 2024
Add 'reader.do --lines [block]'. Fix byte-array size checks in firmware-copy primitive. Fix subtle GC issues with TLS buffers. Fix toitdoc generation for packages. Fix yaml text starting with 'Q'. Fix yaml indented blocks. Fix yaml implicit keys.
Toit v2.0.0-alpha.145 release Apr. 10th, 2024
Add 'toit pkg' and 'toit snapshot' commands. Don't use tasks to wait for services to appear. Handle 'werror' when doing 'toit.compile --analyze'. Make it possible to stream JSON and YAML output onto a writer. Change close-X to mark-closed on io.Reader and io.Writer.
Toit v2.0.0-alpha.144 release Apr. 8th, 2024
Introduce new 'io' library. Optimize garbage collections by avoiding monotonic clock usage. Optimize getting size of builtin collections. Avoid spinning up too many native threads on host platforms. Avoid lock contention on scavenge on host platforms. Start to bring back the 'toit' executable. Roll esp-idf to latest v5.0.
Toit v2.0.0-alpha.143 release Mar. 20th, 2024
Optimize float arithmetic operations. Optimize scavenges by avoiding mprotect calls. Optimize new instance allocations. Optimize byte array slice allocations. Disallow running WiFi and ESPNow at the same time. Make it easier/possible to change channel for ESPNow. Remove deprecated Socket.set-no-delay. Don't emit as much logging for the ESP32S2. Consistently use ALREADY_IN_USE when a resource-pool is exhausted.
Toit v2.0.0-alpha.142 release Mar. 6th, 2024
Track bytecode pointer during instance allocations.
Toit v2.0.0-alpha.141 release Feb. 28th, 2024
Fix regression in memory management for ESP32 targets.
Writing a driver in Toit
Just a few lines of Toit code are needed to reap the full benefits of the Toit ecosystem — without having to rely on firmware developers.
Choosing Toit for your IoT project means that your ESP32-based devices become as easy to program as smartphones: develop your app, deploy it to the devices of your choice, and then update and reinstall as often as needed, even on a shaky connection — all that while the other apps on the device keep running. Welcome to the 21st century, IoT!
Toit meets Visual Studio Code
The extension allows VSCode to provide a rich view of your programs as well as easy access to common functionality like running and deploying apps.