Modules
Modules are the part of JARU that talks to the world: the screen, the sound, the buttons, the board's pins, the network and the files. Each one gathers its functions, properties and constants under a name, which you write in front: Display.open, GPIO.write, Math.PI.

How to use them
A program says which modules it uses with use, one per line or several separated by commas:
use Math, GPIO
use Display
println(Math.sqrt(16)) // 4
- A name that isn't a module doesn't compile:
use Nothinggives the errorModule not found. - If you use a module without its
use, the program compiles, but stops when it reaches that line withERR_MODULE_NOT_FOUND(Module 'Math' not found or not imported.). useis for JARU's modules; your project's files are brought in withimport. The difference is in Programs in several files.
The modules are the same on Windows and on every board. What changes from one platform to another is told by each page in its "Platforms" section.
Some functions don't belong to any module and need no use, such as println, pause, clock or random: they're in the Standard library. The methods of strings, lists and maps are in Strings and in Lists, maps and arrays.
The modules
Graphics and games
| Module | What for |
|---|---|
| Display | Opening the screen or the window, its size and its background, and the game's pace |
| Draw | Drawing points, lines, rectangles, circles, text, images and tilemaps |
| Bitmap | Loading BMP images and working with them |
| Sprite | Sprites with animation, collisions and physics |
| GridMap | 2D grids: tilemaps, collisions with the map and pathfinding |
| Scene | The scene: its sprites, the camera, the physics and the map |
| Sound | Synthesised sounds, PCM samples and music |
Input
| Module | What for |
|---|---|
| Input | The keyboard, the buttons and the gamepad, as game actions |
Hardware
| Module | What for |
|---|---|
| GPIO | Input and output pins, PWM and interrupts |
| I2C | Sensors and other devices connected over I2C |
| LED | Strips and matrices of WS2812 colour LEDs |
| Power | Putting the board to sleep to save power, and waking it up |
Communications
| Module | What for |
|---|---|
| MQTT | Publishing and receiving MQTT messages |
| Http | HTTP requests to APIs and web services |
Data and files
| Module | What for |
|---|---|
| File | Files and folders, in the flash, on the SD card or on the PC |
| Bytes | Byte blocks for binary data |
| JSON | Reading and writing JSON |
System
| Module | What for |
|---|---|
| Timer | Calling a function after some time, once or every so often |
| Math | Mathematical functions and constants |
| GC | The garbage collector, which frees the memory that's no longer used |