Raspberry Pi The singing jelly baby
Starter task Name each of the components on the Raspberry Pi. If you can, tell me what each of them is for.
Command line coding Type these three commands seperately. sudo apt-get install mpg321 wget https://github.com/Rob-Bishop/ RaspberryPiRecipes/blob/master/la.mp3 nano SingingJellyBaby.py
Python coding Import time Import Rpi.GPIO as GPIO Import os GPIO.cleanup() GPIO.setmode(GPIO.BOARD) GPIO.setup(3,GPIO.IN) While True: if GPIO.input(3) == False: os.system(‘mpg321 la.mp3 &’) time.sleep(1) Sudo python SingingJellyBaby.py
Put your headphones on… …Now push your jelly baby!