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.
Defining functions
What if you want to say "Hello" a lot without getting your fingers all tired? You should define a function. Calling a function in Toit is as simple as mentioning its name. If the function doesn’t take arguments that’s all you need.
Learn more...hi:
print "Hello World!"
greet name:
print "Hello $name!"
main:
hi
greet "Kasper"
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.51 release Feb. 3rd, 2023
Break down the components of Toit memory use when out of memory. Support multiple providers for the same service. Fix new lines in LSP server diagnostics. Fix bug in i2c read. Deprecate at and xmodem_1k libraries. Use /etc/resolv.conf to find name servers on POSIX systems. Add Task.group for coordinating work between multiple tasks. Add encoding.url.QueryString. Add option to do a GC before returning process stats.
Toit v2.0.0-alpha.50 release Jan. 25th, 2023
Fix code generation bug for programs with many global variables. Fix race condition in container starting. Trigger a GC when UDP allocations fail. Update allocation limit after all GCs. Warn if an interpolated identifier is followed by -. Improve Windows support.
Toit v2.0.0-alpha.49 release Jan. 18th, 2023
Add warning when '-' is not surrounded by spaces. Fix GPIO open-drain and add a way to change the open-drain of a pin. Handle slices in the fork code. Fix 3 BLE bugs and enable compilation without CRYPTO. Fix an incorrect assert about the heap metadata. Add flat_map method to strings. Support multiple DNS servers. Add support for pullups to bidirectional RMTs. Add wifi.configure.
Toit v2.0.0-alpha.48 release Jan. 13th, 2023
Avoid WiFi usage miscounting on connect/establish errors. Fix getting the WiFi signal strength. Fix bug where TCP error could get lost because of GC. Don't chop up UTF-8 byte sequences in error messages. Deprecate lib/services/wifi_leaker. Add '--drop_empty' to 'string.split'. Record input types for loads and invokes in type propagator. Optimize replace for large arrays.
Toit v2.0.0-alpha.47 release Jan. 4th, 2023
Speed up literal byte array parsing containing chars. Allow UART interrupt priority to be higher. Add every and any methods to Map. Move ESP32 TCP buffers on-heap. Use string slice for trim, so strings stay in flash. Tweaks to GC to preferentially free high addresses. Prune dispatch table entries for methods only called with INVOKE_STATIC. Fix race in starting external processes. Fix regression in sending messages with no freeing on failures. Keep asserts when running the compiler for analysis. Avoid blocking interpreter threads when waiting for TLS handshaking. Put console in UTF-8 mode on Windows. When rehashing a Set or Map, reduce the peak memory used. Use types for non-parameter locals when optimizing. Optimize type checks when using -O2.
Toit v2.0.0-alpha.46 release Dec. 21st, 2022
Add support for getting WiFi access point information. Allow more TLS certificate data to stay in flash. Add -O2 optimization level that uses propagated type information.
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.