Running Your First Program · MagiScript
In this section, we’ll guide you through the process of running your very first MagiScript program.
Steps
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!