๐ŸŽˆ BLACKPOOL OFFERS
๐Ÿšš Free Shipping from 397 USD
๐Ÿƒ TELEPORT PREORDER

Running Your First Program ยท MagiScript

In this section, we’ll guide you through the process of running your very first MagiScript program.

Steps

  1. Open the MagiScript editor and connect your Atom. Follow the Editor Basics guide if you need more details.
  2. Once connected, you can write your first script in the editor provided.
  3. And let’s start with a very basic program. Copy and paste the code below into the editor. You can use the the tiny copy button 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 “Blinky (Simple)” mini-app.
  4. Press the Compile & Upload button (or if you are in the editor, Ctrl-S on Windows or Cmd-S on Mac) to compile and save the program to Atom.
  5. This code will start blinking the LED.
  6. Congratulations! You have just run your first MagiScript program.

				
					function main() {
    atom.led('rgb*');
}
				
			

What is this code about? We have declared a function called main, this function will be called once your app starts (when the upload is complete). 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

You can try examples by either clicking on the App Store in the Editor or by checking any of the examples in the sidebar on this page.

Persisting Mini-Apps

Once you finished developing a mini-app, you can “persist” it. It means that your mini-app will be saved to Atom’s storage, and can be launched as any other mini-apps. To do this, just upload your code, and click on the Persist button. The persisted Atom mini-app can be assigned to a button and launched like built-in mini-apps (see Settings).

To manage (list, run, delete) persisted mini-apps, look for the “Archive” icon next to the Persist button. Click on it, and you will see the list of the available mini-apps. You can delete mini-apps you don’t need anymore.

If youโ€™ve configured a mini-app to automatically launch when you turn on Atom, and itโ€™s causing issues, you can prevent it from starting by holding down the bottom-right button while powering on Atom.run

What's Next?

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!

General

๐Ÿ“ƒย First Steps

MagiScript Editor

๐Ÿ“ƒย Basics

๐Ÿ“ƒย 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

๐Ÿ“ƒย SB Watch

๐Ÿ“ƒย 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