Add a button to your car Pro Preview

We want to be able to interact with the car and its programs and we are going to add the simplest sensor, a button.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #833
  • 09 Apr 2018

TL;DR

Connect two close pins of a button to pin 17 3.3V and to GPIO 26.

 

A button

There is a joke that if you don't know how a button works, you must be from the past.
What is interesting about that button is that it has 4 pins, and they are connected internally in pairs. Those four pins help with the mounting.
A button closes a circuit and electrical current flows from the first pin to the second.

 

Connect the button to the Raspberry Pi

One pin of a button must be connected to a GPIO pin, that is kind of expected. The other pin can be connected eighter to ground (GND), as a diode, or to 3.3V. Here we should start explaining about pull-up and pull-down resistors, but we are not going to. We will keep things simple and straightforward.

In order to simplify our Python code a few minutes later, we are going to connect the other end of the diode to pin 17 - 3.3V. The other pin goes to GPIO 26. 

Do you remember where to find an image with all the pins? Which section had the image in it? It is a vital skill to remember where to look things up. 
Use the navigation to the right, the section was something about connecting the driver to the Raspberry Pi. Open it in a new tab.

Signature,
/ your friendly evil online teacher /

 

The end result

Here is a picture how a connected button looks like:

a button and led connected to raspberry pi

We have purposely folded the button pins to the side.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Perfect STEM course. Module 1 - Smart Car with Raspberry PI
  • 118
  • 42:47
  • 136