Skip to content

ON_OFF_33510B

Turn the output of a supported function generator on or off. Requires a CONNECTION_33510B node at the start of the app to connect with the instrument. The VISA address will then be listed under 'connection'. This node should also work with compatible Keysight 33XXX wavefunction generators (although they are untested). Params: connection : VisaConnection The VISA address (requires the CONNECTION_MDO3XXX node). on_off : str Whether to turn the waveform generation to on or off. channel : str The channel to turn on or off. Returns: out : DataContainer String: ON or OFF depending on on_off value.
Python Code
from flojoy import flojoy, DataContainer, String, VisaConnection
from typing import Optional, Literal


@flojoy(inject_connection=True)
def ON_OFF_33510B(
    connection: VisaConnection,
    on_off: Literal["ON", "OFF"] = "OFF",
    channel: Literal["ch1", "ch2"] = "ch1",
    default: Optional[DataContainer] = None,
) -> String:
    """Turn the output of a supported function generator on or off.

    Requires a CONNECTION_33510B node at the start of the app to connect with
    the instrument. The VISA address will then be listed under 'connection'.

    This node should also work with compatible Keysight 33XXX wavefunction
    generators (although they are untested).

    Parameters
    ----------
    connection: VisaConnection
        The VISA address (requires the CONNECTION_MDO3XXX node).
    on_off: str
        Whether to turn the waveform generation to on or off.
    channel: str
        The channel to turn on or off.

    Returns
    -------
    DataContainer
        String: ON or OFF depending on on_off value.
    """

    ks = connection.get_handle()

    channel_str = channel
    channel = getattr(ks, channel)

    channel.output(on_off)

    return String(s=f"{channel_str}: {on_off}")

Find this Flojoy Block on GitHub

Example

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

In this example, we turn the wavefunction generation of a Keysight 33510B on.

We must first add the CONNECTION_33510B node. This will create the connection to the instrument at the beginning of the app. To allow this we must set the VISA address for this (and all subsequent 33510B nodes). If the address does not appear in the parameters you may have to press REFRESH in the HARDWARE MANAGER tab.

We add two ON_OFF_33510B nodes as well as the TEXT_VIEW node to view the summary of the changes for each one. For the two ON_OFF_33510B we change the channel parameter (to ch1 and ch2) to as well as changing on_off. The node simply turns the wavefunction generation on or off for the chosen channel. In this example we turn Channel 1 (ch1) off and Channel 2 (ch2) on.