🎂 Houdini 150   🚚 FREE FEDEX SHIPPING from 397 USD   🌎 WORLDWIDE SHIPPING for 25 USD

SB Watch

About SB Watch Support

The SB Watch support of Atom remote in MagiScript allows developers to connect your SB Watch to Atom, and control the watch using commands. All SB Watch models are supported, including the Steel and Pocket models. Please note that Steel's Bluetooth range is shorter compared to the other models because of the stainless steel material we have used, so the connection might be not reliable. You can:

  • set the time
  • reset the time to the current time
  • turn accelerometer reporting on/off,
  • receive button events.

Connecting To Your SB Watch

To connect Atom to an SB Watch, you need to use the sbwatch.connect method. The method takes a single argument, which is the ID of the SB Watch you want to connect to.

For example, to connect to an SB Watch with the ID "SBWatch-166666", you would use the following command:

sbwatch.connect('SBWatch-166666');

If Atom is not yet connected to an SB Watch, it will start searching for it, then connect. If an SB Watch is already connected, this command will be ignored. You can use "*" to connect to any SB Watch.

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() {
  sbwatch.connect('SBWatch-166666');
  // ...
}

Setting The Time On The SB Watch

Once you have connected to an SB Watch, you can use the sbwatch.setTime() command to set the time on the watch. This command takes two or three arguments, depending on whether you want to set the seconds as well as the hours and minutes. For example, to set the time to 10:30 AM, you would use the following command:

sbwatch.setTime(10, 30);

If you also wanted to set the seconds to 0, you would use the following command:

sbwatch.setTime(10, 30, 0);

Setting the current time on the SB Watch

You can use the sbwatch.setCurrentTime() command to set the current time on the SB Watch. This will update the watch to display the current time according to the system clock of the SB Watch. To use this command, simply call it with no arguments, like this:

sbwatch.setCurrentTime();

Accelerometer Data (since firmware v1.1.31)

SB Watch has an accelerometer, and Atom can turn it on or off. When turned on, the accelerometer will start reporting raw x, y, and z data.

Accelerometer ON

There are more ways to turn on the accelerometer, but they have the same effect:

ps.accel('on'); // please note that ON or On will not work
ps.accel(true);

Accelerometer OFF

Turning off the accelerometer is similar:

ps.accel('off'); // please note that OFF or Off will not work
ps.accel(false);

Accelerometer Data

You will start receiving events with XYZ data when you turn on the accelerometer via the onEvent function. The value is going to be comma-separated numbers, the type 'xyz', and the source 'ps::accel'.

Example

Here's an example code of how you can use them:

function main() {
  sbwatch.connect('SBWatch-155309');
  sbwatch.accel('on');
}

function onEvent(value, type, source) {
  if (type === 'xyz' && source === 'sbwatch:accel') {
    let xyz = strSplit(value, ',');
    let x = parseInt(xyz[0]);
    let y = parseInt(xyz[1]);
    let z = parseInt(xyz[2]);
    console.log(x, y, z);
  }
}

Receiving Button Events

When an SB Watch is connected, it will start sending button press and release events of the crown. You can process them with the onEvent function.

Read our Buttons documentation page for more details.

Conclusion

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

cross