Looking to use 10 digital inputs to give an analog value for a the X axis of a game controller.
So rather than a true analog input, it will be 10 or 11 stepped positions from the digital inputs.
The digital truth table looks like this -
0 1 2 3 4 5 6 7 8 9 Analog
1 0 0 0 0 0 0 0 0 0 1023
1 1 0 0 0 0 0 0 0 0 921
0 1 1 0 0 0 0 0 0 0 819
0 0 1 1 0 0 0 0 0 0 717
0 0 0 1 1 0 0 0 0 0 615
0 0 0 0 1 1 0 0 0 0 513
0 0 0 0 0 1 1 0 0 0 411
0 0 0 0 0 0 1 1 0 0 309
0 0 0 0 0 0 0 1 1 0 207
0 0 0 0 0 0 0 0 1 1 105
0 0 0 0 0 0 0 0 0 1 0
So pretty straight forward.
I just need to put that value into Joystick.X(value); and I am unsure of the cleanest way to do it.
Very new to coding so I would appreciate fairly basic answers if possible although any help would be appreciated.
So rather than a true analog input, it will be 10 or 11 stepped positions from the digital inputs.
The digital truth table looks like this -
0 1 2 3 4 5 6 7 8 9 Analog
1 0 0 0 0 0 0 0 0 0 1023
1 1 0 0 0 0 0 0 0 0 921
0 1 1 0 0 0 0 0 0 0 819
0 0 1 1 0 0 0 0 0 0 717
0 0 0 1 1 0 0 0 0 0 615
0 0 0 0 1 1 0 0 0 0 513
0 0 0 0 0 1 1 0 0 0 411
0 0 0 0 0 0 1 1 0 0 309
0 0 0 0 0 0 0 1 1 0 207
0 0 0 0 0 0 0 0 1 1 105
0 0 0 0 0 0 0 0 0 1 0
So pretty straight forward.
I just need to put that value into Joystick.X(value); and I am unsure of the cleanest way to do it.
Very new to coding so I would appreciate fairly basic answers if possible although any help would be appreciated.