Led on shield behaves strangely

I have this shield:
mearm
It fits the UNO and similar Arduinos. It's for the MeArm robot arm.

The joysticks work ok, but there's a led that is supposed to operate on pin D3. The anode connects to D3, the catode goes to a 100 Ohm resistor and further to GND. But I can't light up the led, when it is connected to my Leonardo. This is the code:

void setup() {
  // put your setup code here, to run once:
  pinMode(3, OUTPUT);
  
}

void loop() {
  // put your main code here, to run repeatedly:
      analogWrite(3, 255);
      delay(2000);
      analogWrite(3, 0);
      delay(2000);
  
}

When I detatch the shield and connect its D3 pin directly to 5V and the GND pin to ground, the led lights in a beautiful amber colour. So the whole circuit from D3 to GND on the shield seems to be ok. When I attach the shield and run the program, I can measure with my multimeter that I get alternating 5V and 0V between D3 and GND. But the led itself won't light up now. What's going on here?

If I change pin from 3 to 13, the built in led flashes nicely, so the sketch should be ok, too.

Please post a link to where you got the shield

Are you sure the LED is not on Pin 4? It would be easy to accidentally touch 4 when you were applying power to 3 and the schematic I found for a 'do-it-yourself" MeArm Joystick Shield shows the LED possibly connected to Pin 4.

Yes. Here's a better image of the shield:

D4 goes to the right joystick push button. D2 to the left. D3 is definitely the led. What can possibly cause the led not turn on when the shield is connected to my Arduino and my sketch causes a measureable *potential of 5V over that D3 and GND? While detatched and feeding 5V straight to the D3 lights the led up! I feel so stupid now, I just have to repeat the test.

So if you detach the shield and connect shield’s D3 and GND to Arduino’s D3 and GND with wires it works as expected?

I didn't test that yet. Instead of connecting D3 of the shield to D3 on Arduino, I connected D3 of the shield to 5V on Arduino. And it lit up.

Try my suggestion to eliminate possibility that it is PWM issue

Ok, right now I don't get any light at all, no matter how I connect. So don't bother to figure this out. I'll return when I get hands on my multimeter again. Either the led got destroyed or there's a lose contact somewhere. Maybe I toasted the led when I put 5 V over D3 and GND, even though there's the 100 ohm resistor inbetween in series with the led.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.