hbridge2 2.2.0
hbridge2


H BRIDGE 2 Click

H-Bridge 2 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : MikroE Team
  • Date : Dec 2019.
  • Type : GPIO type

Software Support

Example Description

This application controls the speed and direction of motor.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.HBridge2

Example Key Functions

Application Init

Initializes GPIO driver and puts the device to enable state, and the GPIO pin to logic high state.

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.
HBRIDGE2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
hbridge2_init( &hbridge2, &cfg );
log_printf( &logger, "H-Bridge 2 is intialized\r\n" );
Delay_ms ( 200 );
}
#define HBRIDGE2_MAP_MIKROBUS(cfg, mikrobus)
Definition hbridge2.h:65
#define HBRIDGE2_ENABLE
Definition hbridge2.h:92
#define HBRIDGE2_GOUT_HIGH
Definition hbridge2.h:94
void application_init(void)
Definition main.c:32

Application Task

Demonstrates the control of output pins by put output pins to different states. The outputs be changed after every 3 seconds.

void application_task ( void )
{
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define HBRIDGE2_OUT1_L_OUT2_H
Definition hbridge2.h:88
#define HBRIDGE2_OUT1_Z_OUT2_Z
Definition hbridge2.h:89
#define HBRIDGE2_OUT1_H_OUT2_L
Definition hbridge2.h:87
void application_task(void)
Definition main.c:62

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.