The pupils are using a PiFace to interface with external devices such as lights, buzzers and motors to protect the Raspberry Pi from electrical damage due to incorrect wiring and the like and eventually both the boards will be housed in a case to protect them from static and physical damage. But for now the pupils are working with bare boards to give them a feel for the hardware components they are using.
The session started with a quick overview about what makes an electronic circuit and how a switch can be used to turn the power from a battery on and off, and thus control a light. Luckily, the pupils seemed to remeber this from Year 8 Science lessons. This was then extended to show how a Rapberry Pi can act as switch in the circuit. Here are some diagrams used to explain this:
This was followed by a brief recap on the Python code to control the onboard LEDs and outputs on the PiFace - this was useful because Sarah had missed the first session on writing programs to control the PiFace. This can be done in a number of ways, but here is the code that we used:
The pupils then experimented with turning the PiFace lights on and off for longer and shorter amounts of time and then with sequences of lights. This was done by simply changing the pfd.leds number and the sleep() value.
After this the pupils attached a small buzzer to Output 1 of the PiFace and ran their original program to flash an LED. They dicovered that the program not only turns LED 1 on and off, but also Output 1 and, because the buzzer was attached, it beeped like an alarm. This is because the LEDs are designed to shown which of the eight outputs have been switched on for debugging purposes.
More to follow .....



