diff --git a/hardware.yml b/hardware.yml index dac00e5..a49a22f 100644 --- a/hardware.yml +++ b/hardware.yml @@ -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 diff --git a/images/right-button.png b/images/right-button.png new file mode 100644 index 0000000..76baefe Binary files /dev/null and b/images/right-button.png differ diff --git a/images/wrong-button.png b/images/wrong-button.png new file mode 100644 index 0000000..b56d3b8 Binary files /dev/null and b/images/wrong-button.png differ diff --git a/software.md b/software.md index 83a1e94..1757060 100644 --- a/software.md +++ b/software.md @@ -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 diff --git a/software.yml b/software.yml index 7819dae..befd983 100644 --- a/software.yml +++ b/software.yml @@ -1,3 +1,4 @@ - Python 3 Picamera - Python 3 guizero - Python 3 twython +- Python 3 PIL diff --git a/worksheet2.md b/worksheet2.md index d44878c..78d3aa9 100644 --- a/worksheet2.md +++ b/worksheet2.md @@ -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: