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
๐คนโโ๏ธ MagiScript Language
๐คนโโ๏ธ MagiScript Examples
๐คนโโ๏ธ MagiScript Tutorials
General
๐ First Steps
MagiScript Editor
๐ Basics
๐ Keyboard Shortcuts
๐ Running Your First Program
๐ App Store
๐ 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
๐ Operators
๐ Control Flow
๐ Functions
๐ Numbers
๐ Strings
๐ Arrays
๐ Objects
๐ Uint8Array