# User Cloud Message

User Cloud Message syncs your data across devices with your mBlock 5 account. As long as your HaloCode is connected to the internet, you can program it remotely.

**Sign UP / Sign In to mBlock 5**

Click the sign in/sign up icon at the tool bar, and then follow the instructions to finish signing up or signing in.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZKJRjRst-KFFAF%2F0.gif?generation=1569476307937319\&alt=media)

**Toggle on Upload mode**

Click to toggle on Upload mode.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZLK6IXQU4Ir0tm%2F1.gif?generation=1569476307898123\&alt=media)

**Use Stage Button to Control HaloCode Remotely**

We will create a new project combined with Scratch Stage Programming. Use the button on stage to control HaloCode remotely.

**Add User Cloud Message Blocks**

Under "Sprites", click "+" in the Blocks area. The Extension Center page will pop up. Click "Add" to add User Cloud Message blocks.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZMVWwslvzL4-Ar%2F2.gif?generation=1569476307894798\&alt=media)

**Step One: Program Stage Button**

1\. Under "Sprites", click "×" to delete "Panda" (the default sprite).

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZNrUYI0voN66_6%2F3.gif?generation=1569476307876601\&alt=media)

2\. Click "+" to add a new sprite. From the pop-up Sprite Library page, search and choose "Empty Button1". Click "OK".

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZOjQhpqcVAI6MG%2F4.gif?generation=1569476307899387\&alt=media)

3\. Choose "Empty Button1", and drag an Events block when this sprite clicked to the Scripts area.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZP4VpZhL6ma_cA%2F5.gif?generation=1569476307877494\&alt=media)

4\. Add a User Cloud Message block send user cloud message () and name the message "light\_on".

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZQinxOM0W-IZTG%2F6.gif?generation=1569476307862525\&alt=media)

5\. Let's add some special effects to the button. Add a Motion block change y by () and set the value to "-2". Add a Looks block set color effect to () and set the value to "-10".

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZRHT017K6GzSaK%2F7.gif?generation=1569476307876503\&alt=media)

6\. Add a Control block wait () seconds and input "0.2". Drag another Motion block change y by () and set the value to "-2". Then add another Looks block set color effect to ().

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZS3n3cYXc2FlNS%2F8.gif?generation=1569476307900008\&alt=media)

**Step Two: Program HaloCode**

**Connect to the Internet**

1\. Under "Devices", make sure "HaloCode" is selected. Drag an Events block when HaloCode starts up to the Scripts area. Add a Wi-Fi block connect to Wi-Fi () password (). Input Wi-Fi SSID (Wi-Fi name) and password.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZTJSKCWNol7AK3%2F9.gif?generation=1569476307898186\&alt=media)

2\. To ensure Wi-Fi is successfully connected, we need to add a Control block wait () and a Wi-Fi block Wi-Fi is connected?. We want to know when Wi-Fi is connected, so let's add a Lighting block all LEDs light up () to make the LED ring lights up green.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZUcZs3lBy_6sr8%2F10.gif?generation=1569476307912771\&alt=media)

**Cloud Message Script**

When HaloCode receives the user cloud message "light\_on", we want the LED ring to light up red and then go off.

1\. Drag a Wi-Fi block when receiving user cloud message () and input "light\_on". Add a Lighting block all LEDs light up () and set the color to red.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZVC47uIkII1aUl%2F11.gif?generation=1569476307877716\&alt=media)

3\. Add a Control block wait () seconds and a Lighting block light off all LEDs.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZWve7gAtPEmy9s%2F12.gif?generation=1569476307927859\&alt=media)

4\. Click "Upload" to upload the program to HaloCode.

![](https://2169521322-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fpakronics-education%2F-Lpg0r0jyU3XQdgAmqp8%2F-Lpg3yZXHChuq9CmfzGO%2F13.gif?generation=1569476307956137\&alt=media)

5\. Try clicking "Empty Button1" on the stage!

As long as HaloCode is connected to the internet, you can sign in to mBlock 5 in another computer and open the same project to control HaloCode remotely.
