Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:programmingblocks:messages [2018/02/22 14:53]
kniwwelino
en:programmingblocks:messages [2018/05/24 15:06] (current)
kniwwelino
Line 1: Line 1:
 +===== Messages =====
  
 +==== Blocks ====
 +=== Set group for messaging ===
 +{{:en:programmingblocks:messages_1.png|}}
 +
 +This block sets a group for all the messages sent and received in this program. Replace ''myFriends'' with the name of the group.
 +
 +To exchange messages with another friend, the friend needs to use the same group name in his/her program.
 +
 +The block cannot be attached to another block, it is only executed once at the start of Kniwwelino. Just place it before the ''Kniwwelino on start'' and ''Kniwwelino repeat forever'' functions.
 +
 +\\
 +=== Connect RGB LED to messages ===
 +{{:en:programmingblocks:messages_2.png|}}
 +
 +With this block, you can connect your RGB LED to messages. As soon as a message with a color arrives on the topic ''RGB/COLOR'' within the same group as you, your Kniwwelino will light the RGB LED in that color.
 +
 +The block cannot be attached to another block, it is only executed once at the start of Kniwwelino. Just place it before the ''Kniwwelino on start'' and ''Kniwwelino repeat forever'' functions.
 +
 +\\
 +=== Connect matrix to messages ===
 +{{:en:programmingblocks:messages_3.png|}}
 +
 +With this block, you can connect your matrix messages. As soon as a message with a text or icon arrives on the topic ''MATRIX/TEXT'' or ''MATRIX/ICON'' within the same group as you, your Kniwwelino will show the text or icon on the matrix.
 +
 +The block cannot be attached to another block, it is only executed once at the start of Kniwwelino. Just place it before the ''Kniwwelino on start'' and ''Kniwwelino repeat forever'' functions.
 +
 +\\
 +=== Send a text message ===
 +{{:en:programmingblocks:messages_4.png|}}
 +
 +This block allows you to send a text to a topic. Use the topic ''MATRIX/TEXT'' if you have a friend who wants to display the text on his/her matrix. You can also change the topic if, e.g. you want to attach a variable to it on another Kniwwelino and customize the reaction.
 +
 +\\
 +=== Send icon to a topic ===
 +{{:en:programmingblocks:messages_5.png|}}
 +
 +This block allows you to send an icon to a topic. Use the topic ''MATRIX/ICON'' if you have a friend who wants to display the icon on his/her matrix.
 +
 +\\
 +=== Set color to a topic ===
 +{{:en:programmingblocks:messages_6.png|}}
 +
 +This block allows you to send a color to a topic. Use the topic ''RGB/COLOR'' if you have a friend who wants to display the color on his/her RGB LED.
 +
 +\\
 +=== Attach variable to a topic ===
 +{{:en:programmingblocks:messages_7.png|}}
 +
 +With this block, you can attach a variable to a topic. As soon as a message arrives on that topic, it will be set to that variable.
 +
 +To use this block you need to first define a variable in ''Kniwwelino on start'', and then attach this variable to a topic. This block must therefore be placed after ''Kniwwelino on start''.
 +
 +\\
 +==== Example ====
 +You can find an example for using messages in the sample projects [[en:instructions:wristband|]] and [[en:instructions:wristbandv2|]].
 +
 +The project [[en:instructions:rockpaperscissors2|]] shows you how to attach a variable to a topic and use it later on.