Hi All
I'm looking to repeat the same actions to a number of different PCA9685 Modules without having to repeat the code. To try to explain...
input two values from the serial port
first value to identify the board to use and the second a value for an action.
the action will be the same irrespective which board is identified.
so...
serial input = 3,1
code will select board 3 (addressed 0x42 for example)
action 1 will move servos 1,3 ,7,9,11,13 attached to that board.
action 2 would move servos 2,4,6,8,10,12 attached to that board.
etc
if serial input = 2,1
code will select board 2 (addressed 0x41 for example)
action 1 will move servos 1,3 ,7,9,11,13 attached to that board.
action 2 would move servos 2,4,6,8,10,12 attached to that board.
etc
The actions based on action 1 or 2 (up to 10) etc will always be the same whichever board is selected but the board can change to any one of 10.
the only way I can come up with is using the switch statement but that means I will have to have 6 case statements (one for each board) and inside each one have a switch statement with 10 case statements for each action. This would mean the 10 case statements for actions would be identical each time just going to a different board
IF you can make any sense of the above Id like to know how to have one switch statement for the actions and just point to which board to use or any thoughts on another completely different approach.
Many thanks in advance.