SDK Script dio.are

dio.are
/* DESC: This script can be used to set a digital output port.
 * Copyright (C) 2012 NetModule AG, Switzerland
 */
 
void usage()
{
    print("dio.are [dout] [state]\n");
    print("  dout:    digital output [out1|out2]\n");
    print("  state:   state to be set [0|1]\n");
    exit(1);
}
 
if (argc != 3) {
    usage();
}
 
 
dout = argv[1];
state = (int) argv[2];
 
rc = nb_dio_set(dout, state);
if (rc == 0) {
    printf("Setting state %d for digital output '%s'\n", state, dout);
} else {
    printf("Unable to set state %d for digital output '%s'\n", state, dout);
}
 
ret = nb_dio_summary();
printf("%s\n", ret);
 
 
exit(0);