resistor_color

This commit is contained in:
2024-03-11 11:20:18 -04:00
parent af9641f4e9
commit 4265743d75
10 changed files with 289 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
defmodule ResistorColor do
@doc """
Return the value of a color band
"""
@color_codes %{
black: 0,
brown: 1,
red: 2,
orange: 3,
yellow: 4,
green: 5,
blue: 6,
violet: 7,
grey: 8,
white: 9
}
@spec code(atom) :: integer()
def code(color), do: @color_codes[color]
end