This example demonstrates how to set/get the level of an External Digital I/O pin. First, it will set the pin HIGH and read the level of the pin. The expected read value is HIGH. Finally, it will set the pin LOW and read the level of the pin. The expected read value is LOW.
#include <stdio.h>
#include "flex.h"
#define APPLICATION_NAME "External Digital I/O Example"
#define DIGITAL_IO_PIN FLEX_EXT_DIGITAL_IO_1
}
static time_t DigitalIOExample(void) {
for (int i = 0; i < 2; i++) {
printf("Setting: External Digital IO Pin %d to %s\n", DIGITAL_IO_PIN + 1,
get_digital_io_level_str(set_level_val));
printf("Reading: External Digital IO Pin %d level is %s\n", DIGITAL_IO_PIN + 1,
get_digital_io_level_str(get_level_val));
}
}
void FLEX_AppInit() {
printf("%s\n", APPLICATION_NAME);
}