Skip to content

Friendship Groups

ScottD edited this page Feb 21, 2017 · 3 revisions

Inside the Jewelbots Friendship Library, there are 4 functions that can be used to create custom reactions to friends. These 4 functions each return a boolean (true / false value) that tells the user if there are any friends of the selected color group present nearby.

The four functions are:

  • see_red_friends()
  • see_green_friends()
  • see_blue_friends()
  • see_cyan_friends()

Once the Jewelbots Friendship board is selected in the Arduino IDE, there are examples available in the File menu. The example called "Friend_colorgroup_usage" provides an example of checking if any friends in the green color group are present and causes the Jewelbot to buzz and show an animation when a green friend is seen for the first time.

The four functions show changes on the same time period as the lights showing friend group colors. Something to keep in mind, although the Jewelbot checks for other Jewelbots wirelessly multiple times a second the lights and the see friends functions are only updated every few seconds. Similarly, it is important to note that the functions will return true continually when a friend is nearby, which is why the example shows one simple way to make the reaction happen only once when the color group is first encountered.

API

  • see_red_friends()

    This function returns true if any friends in the red color group are nearby. It returns false if none are nearby.

    if (see_red_friends()) {
      // Commands to carry out when red friends are nearby
    }
  • see_green_friends()

    This function returns true if any friends in the green color group are nearby. It returns false if none are nearby.

    if (see_green_friends()) {
      // Commands to carry out when green friends are nearby
    }
  • see_blue_friends()

    This function returns true if any friends in the blue color group are nearby. It returns false if none are nearby.

    if (see_blue_friends()) {
      // Commands to carry out when blue friends are nearby
    }
  • see_cyan_friends()

    This function returns true if any friends in the cyan color group are nearby. It returns false if none are nearby.

    if (see_cyan_friends()) {
      // Commands to carry out when cyan friends are nearby
    }
Clone this wiki locally