Control Category

1. wait () seconds

Wait for a specified period of time to run the script.

Example:

When HaloCode starts up, all the LEDs will light up green, and then go off after one second.


2. repeat ()

Run the script for specified number of times.

Example:

When HaloCode starts up, all the LEDs will light up, and switch between green and red for 10 times. The time gap is 2 seconds.


3. forever

Run the script repeatedly.

Example:

When HaloCode starts up, all the LEDs will light up, and switch between green and red. The time gap is 2 seconds.


4. if () then ()

If the report condition is met, run the script.

Example:

When HaloCode starts up, if the button is pressed, the LED ring will light in the specified color order.


5. if () then () else ()

If the report condition is met, run script 1. If not, run script 2.

Example:

When HaloCode starts up, if it is being shaken, all the LEDs will light up blue, else, orange.


6. wait ()

Wait until the report condition is met. Run the script.

Example:

When HaloCode starts up, if the button is pressed, the LED animation "firefly" will be played.


7. repeat until ()

Run the script repeatedly until the report condition is met.

Example:

When HaloCode starts up, all the LEDs will light up green until the button is pressed. Then all the LEDs will go off.


8. stop ()

Stop specified script or scripts. There are three options: all, this script, or other scripts in sprite.

Example:

When the button is pressed, all the scripts will be stopped.


results matching ""

    No results matching ""