I made application on C# that converts resistor value to colors.I want to show closest standard value and to show color of closest standard value when checkbox is checked?
How to do this:
First I should select the resistance-row (E6 , E12 , E24 , ...).
According to this selection I get the base-values for the row - for example E12 means 1.0 , 1.2 , 1.5 , 1.8 , 2.2 , and so on.
Now I should calculate the row-multiplier. For example if I Input 1344 Ohm multiplier for the base-values is 1000.
Than I should take this multiplier, iterate through the row-values and multiply those value with the multiplier and compare if one value is smaller (or equal) than your entered resistor-value.
Now I should check, which difference is smaller : to the last value of the row or to the next value of the row. The one with the smallest difference should be my reference-resistor.
With this resistor-value I should build color-table and not each resistance-row has the same count of color-rings.