Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Seth
Published

N-Channel MOSFET, BBB, and LEDs

Did you ever want to use a FET for switching your LED on and off?

BeginnerProtip1 hour2,551
N-Channel MOSFET, BBB, and LEDs

Things used in this project

Hardware components

BeagleBone Black
BeagleBoard.org BeagleBone Black
×1
Logic Level FET N-Channel
Logic Level FET N-Channel
×1
LED (generic)
LED (generic)
×1
Resistor 221 ohm
Resistor 221 ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Python
Adafruit_BBIO.GPIO

Story

Read more

Schematics

Image of the Circuit

N-Channel MOSFET

BBB!

Photo and Pinout!

Code

Simple and Concise!

Python
Here it is!
import Adafruit_BBIO.GPIO as GPIO
import time

LED = "P9_12"
GPIO.setup(LED, GPIO.OUT)

while True:
    GPIO.output(LED, GPIO.HIGH)
    time.sleep(5) # this keeps it on for five seconds!
    
    GPIO.output(LED, GPIO.LOW)
    time.sleep(5) # off for five seconds 
    
    # repeats until canceled!

Credits

Seth

Seth

32 projects • 13 followers
Stay there and someone will find you...

Comments