Hi,
I am new to Arduino and trying to create a somewhat complex cable continuity testing program. Some of the cables I will be testing have over 100 pins so I cannot control this with one MEGA 2560 board hence, I have purchased 3 IO expansion boards called "Expand 13 Click" sold by Mikroe (Expand 13 Click).
The main issue I am currently having regards interfacing these expander boards with my Arduino. From what I understand, I can use 8 different addresses so 3 of these boards should be possible to use with my Arduino but, I am unsure on how to address individual pins on each of the expander boards.
I am using a library made by Mikroe that is on their LibStock page (LibStock - Expand 13 click) but cannot work out why the test code they have given with the library wont compile on my Arduino IDE.
I have attached the code below that I am trying to compile and would be grateful if anybody can tell me why this wont compile/ what's missing from the code.
#include <expand13.h>
void setup() {
log_cfg_t log_cfg; /**< Logger config object. */
expand13_cfg_t expand13_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
expand13_cfg_setup( &expand13_cfg );
EXPAND13_MAP_MIKROBUS( expand13_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == expand13_init( &expand13, &expand13_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
expand13_enable_device ( &expand13 );
log_info( &logger, " Application Task " );
}
void loop() {
uint8_t port_value[ 6 ] = { 0 };
uint16_t pin_num = 0;
for ( pin_num = EXPAND13_PIN_0_MASK; pin_num <= EXPAND13_PIN_7_MASK; pin_num <<= 1 )
{
if ( !expand13_get_int_pin ( &expand13 ) )
{
log_printf( &logger, " External input has occurred.\r\n" );
}
memset ( port_value, pin_num, 6 );
expand13_write_all_ports( &expand13, port_value );
expand13_read_all_ports( &expand13, port_value );
for ( uint8_t cnt = EXPAND13_PORT_0; cnt <= EXPAND13_PORT_5; cnt++ )
{
log_printf( &logger, " Status port %d : 0x%.2X\r\n", ( uint16_t ) cnt, ( uint16_t ) port_value[ cnt ] );
}
log_printf( &logger, "\n" );
Delay_ms ( 1000 );
}
}
Thank you.