🌏 Your Peek Just Went Global
🚚 Shipping from 12 USD
πŸ’° DEALS OF THE DAY

Buttons

Button Support

Atom relies heavily on button inputs, making them the most important input method. MagiScript supports button press and release events from three devices:

  • Atom, which has 12 buttons,
  • PeekSmith 3, which has 3 buttons, and
  • SB Watch, which has a single button (the crown).

Atom Hardware

Atom has 12 buttons, numbered from 0 to 11. They are in 4 rows, and there are 3 buttons per row.

Currently, there is no default layout or behavior associated with them, but the system reports button press-related events.

Events

MagiScript is receiving events via the onEvent function. The event structure is the same for the buttons:

  • value: a string with the button ID
  • type: “press”, “release” strings
  • source: “atom:button”, “ps:button”, “sbwatch:button”

				
					function onEvent(e) {
    console.log(e.value, e.type, e.source);
}
				
			

Events Types

Different devices have different support.

  • Atom supports press, release, click, longpress and repeatpress events.
  • PeekSmith has press and release events only (for now, maybe a later firmware will introduce the same events as Atom).
  • SB Watch supports press, release, click, longpress and repeatpress events, however sometimes a click event is coming with no button press (it is a bug, which might be fixed in the future).

Devices & MagiScript

βš›οΈ Atom Remote

πŸ”’ Quantum

πŸ€Ήβ€β™‚οΈ MagiScript Language

πŸ€Ήβ€β™‚οΈ MagiScript Examples

πŸ€Ήβ€β™‚οΈ MagiScript Tutorials

General

πŸ“ƒ First Steps

MagiScript Editor

πŸ“ƒ Basics

πŸ“ƒ Keyboard Shortcuts

πŸ“ƒ Running Your First Program

πŸ“ƒ App Store

πŸ“ƒ Atom Settings (Editor)

πŸ“ƒ Debugging Techniques

Input/Output

πŸ“ƒ Buttons

πŸ“ƒ Vibration Motor

πŸ“ƒ RGB LED

πŸ“ƒ Devices

πŸ“ƒ PeekSmith

πŸ“ƒ Quantum

πŸ“ƒ Teleport

πŸ“ƒ Spotted Dice

πŸ“ƒ SB Watch

πŸ“ƒ IARVEL Watch

πŸ“ƒ Fossil Watch

πŸ“ƒ Cosmos Printer

πŸ“ƒ PeriPage Printer

πŸ“ƒ ATC Remote

πŸ“ƒ Labco Scrabble

πŸ“ƒ Bluetooth Keyboard

πŸ“ƒ Bluetooth Mouse

πŸ“ƒ Timers

πŸ“ƒ Database

πŸ“ƒ Events

πŸ“ƒ System (exit, sleep, rand)

πŸ“ƒ Objects (card, time)

Language

πŸ“ƒ Summary

πŸ“ƒ Comments

πŸ“ƒ Variable Declarations

πŸ“ƒ Operators

πŸ“ƒ Control Flow

πŸ“ƒ Functions

πŸ“ƒ Numbers

πŸ“ƒ Strings

πŸ“ƒ Arrays

πŸ“ƒ Objects

πŸ“ƒ Uint8Array