Can I use Pins to connect external buttons and LED's?
-
Would it be possible to connect an external button as well as an external LED light to the expansion board? I'm hoping to connect a LoPy4 as well as a few buttons to the expansion board but I'm unsure if this is supported. Are there open pins I can use for general purposes like this?
Are there any tutorials on working with the pins? It doesn't look like the LoPy documentation has much there unless I'm missing something.
-
Hey Cooper, the part in the documentation you need is 6.2.1.4 Pin. This gives you the basics of running an LED from a pin or using a button as an input.
If you connect a button between a pin and ground (0V) then you need to configure the pin with a pull-up resistor. Vice-versa works too: a button between the pin and 3.3V with a PULL_DOWN on the pin.
p_in = Pin('P10', mode=Pin.IN, pull=Pin.PULL_UP)When you connect an LED to a pin you need a resistor in series with the LED. 220ohms should work.
When you look at the LoPy Pinout Diagram all those pins marked as GPIOxx can be a button input or LED output. So you can use lots!
- Chris.
-
@prawnhead thank you! That's exactly what I needed to know :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login