The message monkey visualizer sends a sequence of serial messages to a connected device. This page describes the methods implemented by the Monkey
class in the MegunoLink Arduino library to send commands to set the state of message monkey triggers.
Methods
The following methods are specific to message monkey visualizers:
Method Descriptions
The functions and parameters for the Monkey
class are described. Optional parameters are surrounded by []
‘s. Printable
parameters support any type that can be passed to Print::println(…)
including all basic types and classes inheriting from Printable
.
Monkey Constructor
Constructs a Monkey
variable, which can be used to send commands to MegunoLink to set and clear message monkey triggers.
Monkey(Print& Destination = Serial)
Monkey(char const* Channel, Print& Destination = Serial)
Monkey(__FlashStringHelper const* Channel, Print& Destination = Serial)
Name | Type | Required? | Description |
---|---|---|---|
Channel | const char *, const __FlashStringHelper | No | The name of the destination channel for message monkey commands. Defaults to the broadcast channel (NULL ). |
Destination | Print & | No | Sets the serial connection to use for sending messages to MegunoLink. Defaults to Serial , the default Arduino RS232 port. |
1 2 3 4 5 6 |
#include "MegunoLink.h" Monkey Monkey1; Monkey Monkey2(Serial1); // send messages to Serial1 port. Monkey Monkey3(F("Experiment")); // use the 'Experiment' channel for sending messages. Monkey Monkey4("Log", Serial1); // send messages to the Serial1 port using the "Log" channel. |
SetTrigger
Sets a named trigger to the triggered state allowing any await-trigger
waiting on, or subsequently encountering, the trigger to continue.
SetTrigger(TriggerName)
Name | Type | Required? | Description |
---|---|---|---|
TriggerName | Printable | Yes | The name of the trigger to set. Any type that can be passed to Serial.print(…) . |
1 2 3 4 5 6 7 8 9 |
#include "MegunoLink.h" void SendCompleted() { Monkey Mky; Mky.SetTrigger(F("Completed")); Mky.SetTrigger("Done"); Mky.SetTrigger(5); } |
ClearTrigger
Sets a named trigger to the un-triggered state. Any await-trigger
command in the monkey missive will block until the trigger is set. A manual reset trigger is automatically created if it doesn’t already exist.
Auto-reset triggers will clear automatically when read. A separate clear command is not required.
ClearTrigger(TriggerName)
Name | Type | Required? | Description |
---|---|---|---|
TriggerName | Printable | Yes | The name of the trigger to clear. Any type that can be passed to Serial.print(…) . |
1 2 3 4 5 6 7 8 9 |
#include "MegunoLink.h" void InitTriggers() { Monkey Mky; Mky.ClearTrigger(F("Completed")); Mky.ClearTrigger("Done"); Mky.ClearTrigger(5); } |