How do you plan to solve it?
1->>Set a digital pin as OUTPUT
2->>We need to limit current 40mA to 10mA so we should design a resistor value,Let us assume RED LED forward voltage drop is 1.1V and given that forward current is10mA
R=(Vin-Vf)/(If)=(5-1.1)/(10*10-3)=390 ohms
for better saftey as well as refering standard resistance value we take 470ohms.
Since while calculating the power we get P=VI=1.1V*10mA=0.011W
so for better saftey we take 0.25W resistor
so finally we take 470 ohms 1/4 W resistor
const int ledPin = 8;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, HIGH);
delay(800);
digitalWrite(ledPin, LOW);
delay(400);
}
Add video of the output (know more)