Skip to content

STOP_SEND_PERIODIC_CAN_MESSAGE

Download Flojoy Studio to try this app
Stop sending periodic a message to a CAN Bus. Stop sending a message to a CAN device. This block should be compatible with all devices that support the CAN interface. `SEND_PERIODIC_CAN_MESSAGE` can be used to start sending the messages. A connection to the device is required. Use a CAN_CONNECT block to connect to a CAN device. Params: CAN_address : str The CAN device address to connect to. Returns: out : DataContainer Optional: None
Python Code
from typing import Optional
from flojoy import flojoy, DeviceConnectionManager, DataContainer
import can


@flojoy(deps={"python-can": "4.3.1"})
def STOP_SEND_PERIODIC_CAN_MESSAGE(
    CAN_address: str, default: Optional[DataContainer] = None
) -> Optional[DataContainer]:
    """Stop sending periodic a message to a CAN Bus.

    Stop sending a message to a CAN device. This block should be compatible with all devices that support the CAN interface.
    `SEND_PERIODIC_CAN_MESSAGE` can be used to start sending the messages.

    A connection to the device is required. Use a CAN_CONNECT block to connect to a CAN device.

    Parameters
    ----------
    CAN_address : str
        The CAN device address to connect to.

    Returns
    -------
    DataContainer
        Optional: None
    """
    connection: can.interface.Bus = DeviceConnectionManager.get_connection(
        CAN_address
    ).get_handle()

    connection.stop_all_periodic_tasks()

    return None

Find this Flojoy Block on GitHub

Example App

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

This example shows how to send a frame to a CAN bus using the CANable USB-to-CAN adapter. The application sends a first frame intended to indicate the start of a test on a system. Subsequently, the application sends a burst of messages and then sends a frame to indicate the end of the test.

This application uses an CANABLE_CONNECT block to establish a connection to the CAN bus, but this connection could be replaced by any other connection. For example, the PEAK_CONNECT block could be used instead.