Operators

 

1. () + ()

Perform mathematical addition.

1.png

 

Example:

2.png

When Halocode starts up, the LED ring will light up in the specified color order, and after 3 (1+2) seconds, go off.


2. () − ()

Perform mathematical subtraction.

3.png

 

Example:

4.png

When Halocode starts up, the LED ring will light up in the specified color order, and after 2 (3−1) seconds, go off.


3. () * ()

Perform mathematical multiplication.

5.png

 

Example:

6.png

When Halocode starts up, the LED ring will light up in the specified color order, and after 6 (2×3) seconds, go off.


4. () / ()

Perform mathematical division.

7.png

 

Example:

8.png

When Halocode starts up, the LED ring will light up in the specified color order, and after 3 (6÷2) seconds, go off.


5. pick random () to ()

Pick a random number from the specified range.

9.png

 

Example:

0.png

When Halocode starts up, the LED ring will light up in the specified color order, and after a random number (1-5) of  seconds, go off.


6. () > ()

If the value of the specified parameter is greater than the specified value, the report condition is met.

01.png

 

Example:

02.png

When Halocode starts up, if the loudness is greater than 50, all the LEDs will light up red.


7. () < ()

If the value of the specified parameter is less than the specified value, the report condition is met.

03.png

 

Example:

04.png

When Halocode starts up, if the loudness is less than 50, all the LEDs will light up blue.


8. () = ()

If the value of the specified parameter equals the specified value, the report condition is met.

05.png

 

Example:

06.png

When Halocode starts up, if the rotation angle around the x-axis equals 360 degrees, the rotation angle will be reset.


9. () and ()

If both the conditions are met, the report condition is met.

07.png

 

Example:

08.png

When Halocode starts up, if Wi-Fi is connected and Halocode is being shaken, the LED animation "rainbow" will be played.


10. () or ()

If either one of the two conditions is met, the report condition is met.

09.png

 

Example:

10.png

When Halocode starts up, if the button is pressed, or Halocode is being shaken, the LED animation "rainbow" will be played.


11. not ()

The report condition is met when the specified condition is not met.

11.png

 

Example:

12.png

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


12. join () ()

Join two specified character strings.

13.png

 

Example:

14.png

Report speech recognition result.


13. letter () of ()

Report the letter at specified position of a character string.

15.png

 

Example:

16.png

Report the first character of speech recognition result.


14. length of ()

Report the length of a specified character string.

17.png

 

Example:

18.png

Report the length of speech recognition result.


15. () contains ()?

If the specified character string contains the other specified character string, the report condition is met.

19.png

 

Example:

20.png

When Halocode starts up, if the speech recognition result includes "red", all the LEDs will light up red.


16. () mod ()

Calculate the remainder (modular) of two specified numbers.

21.png

 

Example:

22.png

Calculate the modular of 5 dividing 2.


17. round ()

Round the specified number to nearest integer.

23.png

 

Example:

24.png

Round the value of the timer.


18. () of ()

Perorm specific mathematical operation on the specified number. Mathematical operations include: abs (absolute value), floor, ceiling, sqrt (square root), sin, sos, tan, asin, atan, acos, ln, log, e^, and 10^.

25.png

 

Example:

26.png

Ceil the value of the timer.


Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.