Write programs on your device
Programming on SolarOS
Write and run programs directly on your device. Compile native applications in C, or use Python and Lua for interactive prompts, saved scripts, and access to SolarOS services through the solaros API.
Choose a language
| Language | Runtime | Documentation |
|---|---|---|
| C | TinyCC, producing native .elf programs on ESP32-S3 with PSRAM | C development |
| Python | MicroPython, with .py and .mpy files | Python runtime and APIs |
| Lua | Lua, with .lua files | Lua runtime and APIs |
Python and Lua require PSRAM and must be included in your firmware flavor. The full flavor includes C on supported ESP32-S3 boards with PSRAM; other builds can enable the cc group or install it with pkg install cc. Run board and pkg system on the device to check its hardware and packages. See Packages and flavors for availability.
Run your first program
For a complete C example, follow C development on SolarOS.
Open a language prompt from the SolarOS shell:
python
Enter this Python program:
import solaros
print("SolarOS " + solaros.version())
For Lua, run lua from the shell and enter:
print("SolarOS " .. solaros.version())
Use your shell's app-exit key to return to the shell.
Save a script
Use the text editor to save the Python example:
edit /hello.py
Save the file, return to the shell, and run it:
python /hello.py
For Lua, save the Lua example as /hello.lua and run lua /hello.lua.
Work with SolarOS services
The language guides link to APIs for storage, networking, hardware, audio, input, text interfaces, and graphics. Available APIs depend on the services included in your board's firmware flavor.