⌚SB Watch 2
⌚SB Watch 2
🚚 Free fedex shipping from 97 $
Close this search box.

Running Your First Program · MagiScript


Congratulations on taking the first step to become a MagiScript programmer! In this section, we’ll guide you through the process of running your very first MagiScript program.


  • A desktop or laptop machine running Chrome, Edge browser with Bluetooth connectivity. Chrome on Android might work, but the editor screen is not optimized for mobile.
  • Atom, our intelligent remote that can run MagiScript.


  1. Open your browser and navigate to https://peeksmith.electricks.info/atom/.
  2. Press the “Connect to Atom” button. Make sure that Atom is ON, and not connected to another app or device.
  3. Your Atom device should appear in the list, like Atom-1XXXXX. Select it, and click on the Pair button.
  4. Once connected, you can write your first script in the editor provided.
  5. The editor might offer to update the Atom firmware. Do it now, it is less than a minute.
  6. And let’s start with a very basic program. Copy and paste the code below into the editor. You can use the copy icon that appears at the top right corner of the box to copy the code. If you don’t want to copy, click on the App Store button, and select loading the “A Simple Blink example” mini-app.
  7. Press the Compile & Upload button (or if you are in the editor, Ctrl-S on Windows or Cmd-S on Mac) to save the program to Atom.
  8. This code will start blinking the RGB LED.
  9. Congratulations! You have just run your first MagiScript program.


function main() {

What is this code about? We have declared a function called main, this function will be called once you upload the app to your device. Then there’s an atom.led call with the parameter of an rgb* pattern. It will turn on the RGB led and set it to red, green, and blue for 50-50 ms, and repeat the pattern from the beginning.

Loading Example Code to the Editor

There is an App Store button available in the editor. Click on it, and you will see a list of available mini-apps. Select any of them.

You can compile and upload the selected code to Atom. Before that, make sure you set your PeekSmith or SB Watch device names in the code when it is necessary. If you only have one PeekSmith or SB Watch around, you can use * (star) instead of the name.

Persisting Mini-Apps

With the latest firmware, you can persist your Atom scripts. It means that your mini-app will be saved to Atom’s Flash drive, and will be loaded when Atom starts. To do this, just upload your code, and click on the Persist button.

Currently, the persisted Atom app loads after 5 seconds when you turn on the device.

There are several important notes:

  • No Auto-Off: If an Atom app is running, Atom is not going to turn OFF at all. You can add an exit() call to your app, and the app will stop running, so turns OFF after 30 seconds.
  • Deleting the App: When you are uploading a new mini-app, the persisted app will be deleted. This way you can remove your app.
  • Emergency Key: An app with a bug can “brick” your device, or can cause issues. Extremely it can end up in constant restarts. To prevent loading your script, you can press and hold the bottom-right button when your Atom turns ON (or restarts). This will not delete the mini-app, so the next time Atom turns ON, it will start running again.
  • Blinking Blue LED: When no device is connected, the system starts blinking the LED in blue indicating that it is waiting for a connection. It is not ideal for you during a performance, so you can add an atom.led('') call your main function to disable this.

Now that you’ve successfully run a program, you’re ready to start exploring the capabilities of MagiScript. In the following sections, we’ll show you how to create your own mini-apps using MagiScript by examples and cover more advanced topics like variables, data types, and functions.

If you encounter any issues while running your MagiScript program, we are ready to help in the MagiScript Facebook group. Happy coding!