Add images to show how to wire up buttons

This commit is contained in:
Laura 2017-03-16 10:16:08 +00:00
parent 20c6177fcb
commit f72cb685ef
6 changed files with 25 additions and 11 deletions

View file

@ -1,10 +1,12 @@
- name: Raspberry Pi camera module
img: camera
- name: Raspberry Pi touch screen
img: breadboard
- name: 2 x large buttons
img: big-dome-push-button
- name: 2 x tactile push buttons (if you are not using large buttons)
- name: Raspberry Pi touch screen or standard monitor
img: monitor
- name: 2 x tactile push buttons
img: tactile-push-button
- name: Breadboard (only required if using small buttons)
- name: Breadboard
img: breadboard
- name: 4 x Male-female jumper leads
img: jumper-male-to-female
- name: 2 x large buttons (optional, to replace tactile push buttons)
img: big-dome-push-button

BIN
images/right-button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 KiB

BIN
images/wrong-button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 KiB

View file

@ -10,6 +10,8 @@ sudo pip3 install twython
sudo apt-get install python-PIL
```
This will install the necessary software to control the PiCamera, create a GUI, tweet and manipulate images.
If you are using the Raspberry Pi touch screen to make this resource, you will also need to enter the following commands:
```bash

View file

@ -1,3 +1,4 @@
- Python 3 Picamera
- Python 3 guizero
- Python 3 twython
- Python 3 PIL

View file

@ -44,18 +44,27 @@ With the hardware set up, we can begin to program the software that will make ev
1. We will write these two functions so that the buttons know what to do when they are pressed. Functions are usually written at the start of a program immediately after the `import` statements. Add the functions, but with some placeholder code to just print a message when they are pressed, so we can test them.
```python
def next_overlay():
print("Next overlay")
```python
def next_overlay():
print("Next overlay")
def take_picture():
print("Take a picture")
def take_picture():
print("Take a picture")
```
1. Press `F5`, save and run your program. Try pressing each button and check that a different message pops up for each in the Python shell.
![Test the buttons](images/test-buttons.png)
If your buttons do not produce this result, first check that they are wired up correctly. The button pins should be in **different** rows of the breadboard like this:
![Right way to put button](images/right-button.png)
![Wrong way to put button](images/wrong-button.png)
You may have buttons with two legs on each side. These should be placed over the gap on your breadboard with the jumper wires both attached into one side. Take care to ensure the jumper wires are in the same rows as the legs of the button.
![Four prong button](images/four-prong-button.png)
## Set up the camera
1. Now that we know the buttons work, let's set up the camera. First add an import statement with the others at the top: