In a perfect German tradition Conrad electronics shop released an Advent Calendar for Raspberry Pi. You can buy it online or from a Conrad shop if you get to go to Germany in a town with a Conrad shop. Got mine from the Conrad in Leipzig but online is available at Conrad Online
There are boxes for 24 days, so each day in December until Christmas you do an experiment.
I am not the one to stick to a calendar so I already did the first 5 days 🙂
Some details, the box comes with German manual. If you want an English one there is the translated one on Conrad site.
This is a copy: 001540860-an-01-en-CONRAD_RASPBERRY_PI_ADVENTSKALENDER_2017
There is also a package with the scratch and python3 sources. I hate that it is hosted on some site that asks to register.
Here is my copy: 15002-8-Conrad-Adventskalender-raspberry-pi-2017-programme
Day 1: I got a red led and 2 wires
There is a little scratch program that lets you control the led. Let is connected on on GPIO 4 and GND.
Day 2: I got a patch board, a green led, 1 cable and 2 pin strips (3 pins).
This starts to look nicer already. Second led is connected to GPIO 10
This day we learn how to control 2 leds with scratch.
Note: I like my new configuration of the 5 PIs. I discovered that the metal “Cooler Master” laptop stand has the holes matching the distance of the holes from the Raspberry Pi cases I use. A perfect match so I was able to screw the 5 PIs on the plate. Under the plate you may notice the switch and the router that stay on another Hama laptop stand with two big fans and blue leds. I got now a very compact setup.
Day 3: I got another two cables that will be used later in Day 4
This day we learn to control the leds using python3 and make them blink.
#!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.OUT) GPIO.setup(10, GPIO.OUT) for i in range(10): GPIO.output(4, True) GPIO.output(10, False) time.sleep(0.5) GPIO.output(10, True) GPIO.output(4, False) time.sleep(0.5) GPIO.cleanup()
Make sure to install support for python3 and python GPIO support:
# apt-get install python3 idle3 python3-rpi.gpio
Day 4: I have a button and another pin strip (also cables from Day 3 are used)
Here I have to connect a button on the patch board. GPIO 7 is used is input connected to the button.
There is a simple scratch program used to control the leds and the button.
Day 5: I got two extra cables to be used for latter
In this experiment we have to control the same leds and button with a python3 program
#!/usr/bin/python import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.OUT) GPIO.setup(10, GPIO.OUT) GPIO.setup(7, GPIO.IN, GPIO.PUD_DOWN) try: while True: if GPIO.input(7)==True: GPIO.output(4, True) GPIO.output(10, False) else: GPIO.output(10, True) GPIO.output(4, False) except KeyboardInterrupt: GPIO.cleanup()
This will make the button able to control the leds. If button is pressed the red one is one else the green one is on.
To be continued …
Contribute to this site maintenance !
This is a self hosted site, on own hardware and Internet connection. The old, down to earth way 🙂. If you think that you found something useful here please contribute. Choose the form below (default 1 EUR) or donate using Bitcoin (default 0.0001 BTC) using the QR code. Thank you !