This shows you the differences between two versions of the page.
— |
sdk:scripts:dio [2015/05/05 15:04] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SDK Script dio.are ====== | ||
+ | <code c 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); | ||
+ | |||
+ | </code> | ||