I cant get my head around how to do this. I have a nested list, which I want to use as function arguments.
The function.
pi.bb_i2c_zip(SDA, [4, address, 2, 7,18, {commands} ])
I would like to loop through the list so the end result is like below.
NestedList = [[1,2,3,4,5,6,7,8],[2,0,2,0,2,0],[0,0,1,1,0,0]]
pi.bb_i2c_zip(SDA, [4, address, 2, 7,18, 1,2,3,4,5,6,7,8 ])
pi.bb_i2c_zip(SDA, [4, address, 2, 7,18, 2,0,2,0,2,0 ])
pi.bb_i2c_zip(SDA, [4, address, 2, 7,18, 0,0,1,1,0,0 ])
If i try using this;
for i in NestedList:
pi.bb_i2c_zip(SDA, [4, address, 2, 7,18, i ])
I get this errror; TypeError: an integer or string of size 1 is required
This is because the function is expecting bytes and the loop above is placing in an actual list of bytes.. E.g. pi.bb_i2c_zip(SDA, [4, address, 2, 7,18,[1,2,3,4,5,6,7,8]])
in summary, how can I place;
1,2,3,4,5,6,7,8
into the function and not this
[1,2,3,4,5,6,7,8]
pi.bb_i2c_zip(SDA, [4, address, 2, 7,18, *i ])