signalrelay 2.0.0.0
Main Page

Signal Realy click

Signal Relay click can be used for ON/OFF control in various devices. It carries four ultra-small GV5-1 PCB relays from Omron and runs on a 5V power supply.

click Product page


Click library

  • Author : Katarina Perendic
  • Date : okt 2019.
  • Type : GPIO type

Software Support

We provide a library for the SignalRealy Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

‍This library contains API for SignalRealy Click driver.

Standard key functions :

  • Config Object Initialization function.

    ‍void signalrelay_cfg_setup ( signalrelay_cfg_t *cfg );

    - Initialization function.

    ‍SIGNALRELAY_RETVAL signalrelay_init ( signalrelay_t *ctx, signalrelay_cfg_t *cfg );

  • Click Default Configuration function.

    ‍void signalrelay_default_cfg ( signalrelay_t *ctx );

Example key functions :

‍Demo application is used to shows basic controls Signal Relay click.

The demo application is composed of two sections :

Application Init

‍Configuring clicks and log objects. Settings the click in the default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----");
// Click initialization.
SIGNALRELAY_MAP_MIKROBUS( cfg, MIKROBUS_1 );
signalrelay_init( &signalrelay, &cfg );
signalrelay_default_cfg ( &signalrelay );
}
#define SIGNALRELAY_MAP_MIKROBUS(cfg, mikrobus)
Definition signalrelay.h:64
SIGNALRELAY_RETVAL signalrelay_init(signalrelay_t *ctx, signalrelay_cfg_t *cfg)
Initialization function.
void signalrelay_default_cfg(signalrelay_t *ctx)
Click Default Configuration function.
void signalrelay_cfg_setup(signalrelay_cfg_t *cfg)
Config Object Initialization function.
void application_init(void)
Definition main.c:33
Click configuration structure definition.
Definition signalrelay.h:124

Application Task

‍Alternately sets relays to ON-OFF state...

void application_task ( void )
{
uint8_t cnt;
// Task implementation.
for ( cnt = 1; cnt <= 4; cnt++ )
{
log_info( &logger, " *** Relay [ %d ] ON ", cnt );
Delay_ms ( 200 );
log_info( &logger, " *** Relay [ %d ] OFF ", cnt );
Delay_ms ( 200 );
}
}
void signalrelay_relay_state(signalrelay_t *ctx, uint8_t relay, uint8_t state)
Relays state.
#define SIGNALRELAY_STATE_ON
Definition signalrelay.h:95
#define SIGNALRELAY_STATE_OFF
Definition signalrelay.h:96
void application_task(void)
Definition main.c:60

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SignalRealy

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.