The Prompt component lets your Arduino program ask the user a question by sending a serial command and receive a response.

To have MegunoLink request confirmation before sending a message, use a button control and set its ConfirmBeforeSending property to true.

Prompt component properties
Property Access Type Method Description
DefaultPrompt Design only string ShowPrompt The default message to present to the user when the prompt is triggered. This can be overridden with a custom message sent from your Arduino.
Title Design only string The window title for the prompt message
OnNoSend Design only string Sets the command sent to a remote device when a user clicks the No button on the prompt
OnYesSend Design only string Sets the command sent to a remote device when a user clicks the Yes button on the prompt
Id OnNoSend/ OnYesSend only int The (optional) prompt ID supplied when the prompt is triggered.
Response OnNoSend/ OnYesSend only Yes | No The response selected by the user.

Example

In this example, the Arduino program asks for confirmation before ‘launching’ a missile using the Prompt component when it receives a command to start the missile launch.

The function Cmd_BeginMissileLaunch handles the command sent with the Begin Missile Launch! button is clicked on the interface panel. It sends a command back to the interface panel to ask for launch confirmation, which displays the prompt to the user. When the user selects a response on in the prompt window, MegunoLink sends a PromptResponse command which includes the prompt Id and response information. You can’t be too careful when launching missiles!

The example Arduino code and MegunoLink project are available in the MegunoLink library. Select Library ExamplesInterface PanelPrompt to open the example.

Prompt example interface panel

Interface panel setup for the prompt example. The OnNoSend and OnYesSend properties set the messages that are sent when the prompt response is selected.

Prompt example

MegunoLink displays a window with Yes and No responses when a Prompt component is triggered.

Start typing and press Enter to search