In Arduino a built in LED is attached with number 13 Digital pin. Is there any LED like Arduino in Raspberry Pi,which I can use to test my code?


Unfortunately the Pi has no GPIO programmable built-in LED.

Instead, you'd have to make a simple circuit between two pins, e.g. pin 9 and 11 (https://pinout.xyz/), with an LED and resistor (around 100 ohms should be fine). You can then control the LED using the gpio command. gpio mode 11 out to enable output, gpio write 11 1 to turn on the LED, and gpio write 11 0 to turn off the LED.

More details are available at https://thepihut.com/blogs/raspberry-pi-tutorials/27968772-turning-on-an-led-with-your-raspberry-pis-gpio-pins.

  • Thanks for the answer. otherwise I would go look for this an this would be total time waste. – Sohan Arafat Sep 21 at 1:05

Yes, it is possible to control the built-in leds. Green LED is easier.

According to here, though it is probably Pi 3 specific, since it didn't work for my Pi 4:

In the terminal:

sudo echo 1 > sudo /sys/class/leds/led0/brightness

This turns the green led on.

sudo echo 0 > sudo /sys/class/leds/led0/brightness

To turn off the activity indicator override: (put it back how it was)

echo mmc0 >/sys/class/leds/led0/trigger

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.