How do you plan to solve it?
i usually separate this kind of problems in two: Hardware and firmware
Hardware: Let´s find the resistance value that allows a 10mA flowing through the LED
Vin = 5v, Vd = 1.8v ----> Vr = 5v - 1.8v = 3.2v
R = Vr / Ir = 3.2v / 10mA = 320 ohms -----> 330 ohms