The Test Monitor panel lets your Arduino program report the results from simple self tests in the Program Devices visualizer. It can be used stand-alone, or as part of a serial programming sequence. When part of a sequence, the next programming step doesn’t continue until all registered tests have passed. If any test reports failure the sequence stops so that you can fix any problems.

Test Monitor Panel

Tests are identified either by name or an integer (test id) when you send results from your Arduino program. Only results for pre-configured tests will be display; other results will be ignored. Your Arduino program can send a pass or fail result for each test. It can also include a value, which will be displayed next to the test result. For example, if you’re testing the power supply voltage is within the allowed range it can be helpful to include the actual voltage as well as the pass/fail indication.

The Test Monitor is ready to display results as soon as the serial port is connected. So if you send the test results from the end of your loop, and your Arduino resets whenever a connection is made, the results will display automatically. Sometimes a small delay (1 – 2 seconds) is needed before the results are sent, to allow time for the connection to be made.

The Test Monitor panel can send a command to the Arduino when you push the Run button. This command can start the test on the Arduino and send back the results.

Creating a Test Monitor Panel

To create a test results panel, click the Add Programmer drop-down menu on the Program Devices visualizer toolbar. Select Test Monitor from the list.

Use the Name field to help you remember what the panel is for. After you’ve configured the tests (see below), you can press the:

  • Reset button to clear the previous test results ready for a new test
  • Run to clear the previous test result and send the begin test command
  • Configure to configure the tests

The lock button disables the Run button. This helps effectively disables the test result for programming sequences.

Configuring a Test Monitor Panel

You have to configure the Test Monitor panel before it will show any test results. Start by clicking the Configure button to show this configuration dialog:
Test Monitor Configuration

Select the source that the panel will monitor for test results and the maximum amount of time it will wait for all tests to complete.

If your Arduino program requires a special command to start tests and/or report test results, check the Send message to start test and enter the command in the box provided.

Add one or more tests using the buttons provided. Results will only be reported for tests that are in the list. You can report test results using either the name or id assigned when you create the test.

Sending data from an Arduino

We’ve created an Arduino library to send self-test results from your Arduino sketch to a test monitor panel. After you install the Arduino library,

  1. Add #include "MegunoLink.h" to the top of your Arduino program,
  2. Create a TestReport varliable, then
  3. Call ReportResult, for example, to send test-results to the test monitor panel.

The Test Monitor Arduino library reference has details of all the methods available.

Example

This simple example runs a test and reports the result whenever it receives the !Test\r\n command. The test checks that the power supply voltage to the Arduino is between 4.9 and 5.1 V. The test passes if the supply voltage is within range and fails otherwise. The example Arduino code and MegunoLink project can be found in the Library Examples menu on the main MegunoLink toolbar.

Start typing and press Enter to search