Thanks, Jeffrey,
I appreciate for the material you provided. It's just at this stage I don't have that much time to start from beginning. I am strong on mechanical design side but not software.
I am trying to use all the AO to control a LED array.
Tried to modify the codes, but error just popup here and there, following is the code I am struck with, any little help to me is big.
def main():
options = OptionFlags.DEFAULT
channels = (0,1)
hat0 = mcc152(0)
hat1 = mcc152(1)
hat2 = mcc152(2)
for channel in channels:
hat0.a_out_write_all(channel, get_input_values)
hat1.a_out_write_all(channel, get_input_values)
hat2.a_out_write_all(channel, get_input_values)
address = select_hat_device(HatIDs.MCC_152)
run_loop = True
error = False
while run_loop and not error:
try:
values = get_input_values()
except ValueError:
run_loop = False
else:
# Write the values.
for hat in range(3):
print(' ', hat, end='')
if hat == 0:
for channel in channels:
hat.a_out_write_all(values=values, options=options)
elif hat == 1:
for channel in channels:
hat.a_out_write_all(values=values, options=options)
else:
for channel in channels:
hat.a_out_write_all(values=values, options=options)
except (HatError, ValueError):
error = True
if __name__ == '__main__':
# This will only be run when the module is called directly.
main()