Labco Scrabble
About Labco Scabble Support
The Labco Scrabble support of Atom remote in MagiScript allows developers to connect your Scrabble to Atom, and control the Scrabble using commands.
Connecting To Your Scrabble
To connect Atom to Scrabble, you need to use the labco.connect
method.
If Atom is not yet connected to a Scrabble device, it will start searching for it and then connect. If a Scrabble device is already connected, but the specified name is different, Atom will disconnect from the Scrabble device, and start searching for the specified name.
You can use theΒ *
character to connect to any available Scrabble device.
The method is flexible regarding its parameters. Let’s review the possible options.
Connecting without a Device Name
This is the recommended way to connect, as this way you can share your code and no change will be necessary.
labco.connect();
You can configure a default Scrabble device ID in the Atom Editor Settings. By default, it is *, which means it will connect to the first Scrabble device it finds.
Connecting by Specifying a Device Name
You can pass a Scrabble device ID as the first parameter, and Atom will connect to it.Β For example, to connect to a Scrabble with the ID “Labco-166666”, you would use the following command:
labco.connect('Labco-166666');
This is the legacy way, we recommend using it only if you have a specific use case.
Connecting by Specifying a Device Name and a Callback
labco.connect('Labco-166666', connected);
function connected(event) {
console.log('Labco connected.');
}
labco.connect('Labco-166666', connected);
function connected(event) {
console.log('Labco connected.');
}
Using the labco.connect Method
The best way to connect is by adding this call to the beginning of theΒ main
function, which runs when the code is loaded.
function main() {
labco.connect();
// ...
}
Disconnecting your Scrabble
To disconnect your Scrabble, simply call the disconnect method. It will disconnect the active Scrabble device.
labco.disconnect();
You can also specify by it’s name which device you would like to disconnect:
labco.disconnect('Labco-036666');
Querying the Connected Scrabble
You can query the Bluetooth name (ID) of the Scrabble device(s) Atom connected to. The id method gives you the active device’s ID, while the ids method returns an array with the Scrabble devices Atom connected to.
labco.id(); // the active Scrabble device
labco.ids(); // all the Scrabble devices Atom connected to
You can query the connected Scrabble devices as a list of device objects as well using the list method.
const devs = labco.list();
for (let i = 0; i < devs.length; i++) {
console.log(devs[i].id, devs[i].battery);
}
If more than one Scrabble device is connected, you can set one of them to active with the select method. Messages will be sent to this unit.
labco.select('Labco-036666');
Battery Percentage
The battery level of Scrabble can be queried with the battery method. It reports a number between 0 and 100. It is checked when Atom connects to the device, and is subsequently updated every other minute.
const percentage = labco.battery();
console.log(Scrabble battery level: ${percentage}%);
Conclusion
The Scrabble support of Atom remote in MagiScript provides a convenient way for developers to connect their Scrabble to Atom and control its functions. By following the steps outlined in this documentation, you can easily connect to your Scrabble and set its time using MagiScript.
General
π First Steps
MagiScript Editor
π Basics
π Keyboard Shortcuts
π Running Your First Program
π App Store
π Debugging Techniques
Examples
π Atom Time
ποΈ Time Practice
π 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
π Quantum
π Teleport
π Spotted Dice
π SB Watch
π IARVEL Watch
π Fossil Watch
π Cosmos Printer
π PeriPage Printer
π ATC Remote
π Labko 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