View on GitHub

Introduction to Raspberry Pi

Artisan's Asylum

Session 2 - LED Blink and Stopwatch Examples

LED Blink Breadboard Layout

LED Blink Breadboard Layout

Source Code

Next, create a stopwatch script. When the user presses a button, a timer should be started and the LED turned on. When the button is pushed again, the timer should be stopped and the LED turned off. Finally, the amount of time between button presses should be printed. The pushbutton should be connected to GPIO Pin 4 as shown below. Don't forget the 10k pullup resistor!


Stopwatch Breadboard Layout

Stopwatch Breadboard Layout

Source Code

References