πŸ–¨οΈ COSMOS PRINTER
🚚 Shipping from 12 USD
πŸ’° DEALS OF THE DAY

ATC Remote

About ATC Remote Support

The ATC Remote support of Atom remote in MagiScript allows developers to connect your ATC to Atom, and control the ATC using commands.

Connecting To Your ATC

To connect Atom to a ATC, you need to use the atc.connect method.

If Atom is not yet connected to an ATC device, it will start searching for it and then connect. If an ATC device is already connected, but the specified name is different, Atom will disconnect from the ATC device, and start searching for the specified name.

You can use theΒ * character to connect to any available ATC 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.

				
					atc.connect();
				
			

You can configure a default ATC device ID in the Atom Editor Settings. By default, it is *, which means it will connect to the first ATC device it finds.

Connecting by Specifying a Device Name

You can pass an ATC device ID as the first parameter, and Atom will connect to it.Β For example, to connect to an ATC with the ID “ATC-166666”, you would use the following command:

				
					atc.connect('ATC-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

As a second parameter, you can specify a callback function. It will be called when Atom successfully connects to the ATC device. It will be called immediately if Atom is already connected to an ATC.

				
					atc.connect('ATC-166666', connected);

function connected(event) {
  console.log('ATC connected.');
}
				
			
When an ATC is connected, then an event will be triggered. Both the onEvent function, and the callback will be called with the event details.

				
					atc.connect('ATC-166666', connected);

function connected(event) {
  console.log('ATC connected.');
}
				
			

Using the atc.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() {
  atc.connect();
  // ...
}
				
			

Disconnecting your ATC

To disconnect your ATC, simply call the disconnect method. It will disconnect the active ATC device.

				
					atc.disconnect();
				
			

You can also specify by it’s name which device you would like to disconnect:

				
					atc.disconnect('ATC-036666');
				
			

Querying the Connected ATC

You can query the Bluetooth name (ID) of the ATC device(s) Atom connected to. The id method gives you the active device’s ID, while the ids method returns an array with the ATC devices Atom connected to.

				
					atc.id(); // the active ATC device
atc.ids(); // all the ATC devices Atom connected to
				
			

You can query the connected ATC devices as a list of device objects as well using the list method.

				
					const devs = atc.list();
for (let i = 0; i < devs.length; i++) {
  console.log(devs[i].id, devs[i].battery);
}
				
			

If more than one ATC device is connected, you can set one of them to active with the select method. Messages will be sent to this unit.

				
					atc.select('ATC-036666');
				
			

Battery Percentage

The battery level of ATC 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 = atc.battery();
console.log(atc battery level: ${percentage}%);
				
			

Blink with the ATC

Makes the LED on the active ATC device blink according to a specified pattern.
				
					atc.blink('..-'); // short-short-long
atc.blink('-.-.'); // long-short-long-short
atc.blink('-'); // Single long blink
				
			

Conclusion

The ATC support of Atom remote in MagiScript provides a convenient way for developers to connect their ATC to Atom and control its functions. By following the steps outlined in this documentation, you can easily connect to your ATC and set its time using MagiScript.

General

πŸ“ƒ First Steps

MagiScript Editor

πŸ“ƒ Basics

πŸ“ƒ Keyboard Shortcuts

πŸ“ƒ 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

πŸ“ƒ 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

πŸ“ƒ Variable Declarations

πŸ“ƒ Operators

πŸ“ƒ Control Flow

πŸ“ƒ Functions

πŸ“ƒ Numbers

πŸ“ƒ Strings

πŸ“ƒ Arrays

πŸ“ƒ Objects

πŸ“ƒ Uint8Array