GPIO connection with LED

GPIO Connection with LED

                                  A simple way to connect led with beagle bone black. Actually, I am using
P9_23 (gpio_49) pin to connect with led.

                 In that circuit Led Anode(+) is directly connected to gpio_49 and cathode(-) is connected to PCB Negative(-). I  am directly connect led to GPIO because it gives 3.3v supply, it is sufficient to glow the color led's. If u are using white led better to add 220ohm resistor to the anode side.   

NOTE:

  1. Make sure the POWER SUPPLY is given to the breadboard taken from beaglebone only.
  2. Once root or restart your board you need to enable GPIO pin again.
                The following commands are used to enable the GPIO and toggle the led
       
        $cd /sys/class/gpio/
        $echo 49 > export     (49 is gpio_49 number)
        $cd gpio49/
                 
                 The above commands enable the GPIO_49. If you enable any another GPIO port please refer port is using that pin in pin mux configuration. The following image shows all GPIO's available in the board.
     The commands used to toggle the led 

              $cd gpio49/
              $cat direction                          (check direction of led. )
              $echo out > direction              (* Always led's working on OUT direction only)
              $cat value                                ( check output value high or low) 
              $echo 1 > value
              $echo 0 > value

This is the way to enable the GPIO and toggle the led, and we can toggle led with API and shell scripting also.

Comments

Post a Comment