pixelmatix / AnimatedGIFs

MIT License
62 stars 34 forks source link

How can I connect a button to Teensy 3.2? #28

Closed PeideSuperman closed 5 years ago

PeideSuperman commented 5 years ago

I try to connect a button to Teensy 3.2. This button serves to change the displayed conditions of the SmartMatrix. If the button is not pressed it will display gif1 and if the button is pressed it will display gif 2. I have already done with the coding part but it is the connection of the button brother me. example IMG_6256

WX20190323-221726@2x

Here are some photos of the current circuit and the codes I am using to test if the connection works. The result is when the button is not pressed, the serial monitor shows 1 and when the button is pressed, the monitor shows offline. It is supposed to show 0 when the connection is really successful. Then I try to connect this whole thing the LED screen. What happens is when the button is not pressed, it shows gif1 and when it is pressed, the screen shut down.

embedded-creations commented 5 years ago

What are you connecting to the button? Looks like (from a glance), you're connecting both power and ground

You typically only connect ground, and the GPIO pin you want to toggle. Then use a pullup (maybe internal pullup) on the GPIO line to make it go high when the button is pressed. This may be a better question for the PJRC or Arduino forums if you need more help.

embedded-creations commented 5 years ago

(At a glance it looks like you're connecting power to ground through the button when you press it)

PeideSuperman commented 5 years ago

What are you connecting to the button? Looks like (from a glance), you're connecting both power and ground

You typically only connect ground, and the GPIO pin you want to toggle. Then use a pullup (maybe internal pullup) on the GPIO line to make it go high when the button is pressed. This may be a better question for the PJRC or Arduino forums if you need more help.

Thank you so much! It works!