🎂 Houdini 150   🚚 FREE FEDEX SHIPPING from 397 USD   🌎 WORLDWIDE SHIPPING for 25 USD

Vibration Motor

Atom's Hardware

Atom has a vibration motor that can be used for creating custom vibration patterns. These vibration patterns are similar to Morse code but with many extensions.

In MagiScript, you can start vibration patterns with an atom.vibrate(pattern) function call, where the parameter is a vibration pattern.

atom.vibrate('...'); // will play 3 short vibrations

PeekSmith Support

You can also send vibration patterns to a PeekSmith that Atom is connected to. Read more details about it on the PeekSmith page of the MagiScript documentation, however the format is similar:

ps.vibrate('...'); // will play 3 short vibrations on PeekSmith

Basic Vibrations

There are 4 different lengths of vibrations Atom knows:

'    a very short notification (used for button press feedback)
.    a short vibration (default length is 100ms)
-    a long vibration (default length is 250ms)
=    an extra long vibration (default length is 350ms)

You should send a combination of these characters, the pattern to vibrate:

atom.vibrate('...'); // plays three short vibrations
atom.vibrate('---'); // plays three long vibrations
atom.vibrate('==='); // plays three extra-long vibrations
atom.vibrate('-..'); // plays a long and two short vibrations

Numbers and English Letters

Numbers and English characters are also supported. English characters will be played as Morse code. Numbers can be configured to play as magicians used to encode numbers or as Morse code defines them. The default for the numbers is Morse encoding.

Morse encoding

0: -----     1: .----     2: ..---     3: ...--     4: ....-
5: .....     6: -....     7: --...     8: ---..     9: ----.

Only shorts

0: .......... (ten shorts)      5: .....
1: .                            6: ......
2: ..                           7: .......
3: ...                          8: ........
4: ....                         9: .........

Long means 3

0: ---.                         5: -..
1: .                            6: --
2: ..                           7: --.
3: -                            8: --..
4: -.                           9: ---

Long means 4

0: --..                         5: -.
1: .                            6: -..
2: ..                           7: -...
3: ...                          8: --
4: -                            9: --.

Long means 5

0: --..                         5: -
1: .                            6: -.
2: ..                           7: -..
3: ...                          8: -...
4: ....                         9: -....

Letters Encoding with Morse Code

A: .-           H: ....         O: ---          V: ...-
B: -...         I: ..           P: .--.         W: .--
C: -.-.         J: .---         Q: --.-         X: -..-
D: -..          K: -.-          R: .-.          Y: -.--
E: .            L: .-..         S: ...          Z: --..
F: ..-.         M: --           T: -
G: --.          N: -.           U: ..-

Examples

atom.vibrate('SOS'); // plays ... --- ...
atom.vibrate('OK');  // plays --- -.-
atom.vibrate('12');  // plays .---- ..--- (by default)

Repeats

A pattern will be played once by default. However, you can add exclamation characters to the end of the pattern, and it will be played as many times as the number of exclamation characters.

atom.vibrate('.');    // plays a short vibration once
atom.vibrate('.!');   // plays a short vibration once
atom.vibrate('.!!');  // plays a short vibration twice
atom.vibrate('.!!!'); // plays a short vibration three times

Conclusion

This is how you can use the vibration motor from MagiScript! Hopefully, this information has helped you get started with configuring vibration patterns in your projects. Don't hesitate to experiment with different patterns and lengths to create custom vibrations that suit your needs.

cross