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).
General
πΒ First Steps
MagiScript Editor
πΒ Basics
πΒ Running Your First Program
πΒ App Store
πΒ Atom Settings (Editor)
πΒ Debugging Techniques
Examples
πΒ Atom Time
ποΈ Time Practice
πΒ Atom Pi (Pi Revelations)
πΒ Atom Drum
ποΈ Atom Stack
πΒ Atom Square
πΒ Atom Level
πΒ Atom THMPR
πΒ Poker Hands
πΒ Keyboard Numeric
πΒ Keyboard NOKIA
πΒ Keyboard Cursor
πΒ Keyboard Media
πΒ Keyboard Custom
Input/Output
πΒ Buttons
πΒ Vibration Motor
πΒ RGB LED
πΒ Devices
πΒ PeekSmith
πΒ SB Watch
πΒ 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