EG Raspberry Pi Workshop
EG1003 | Presented by Prototyping
Overview
Raspberry Pi Overview
Raspberry Pi Hardware
Raspberry Pi GPIO Pins
GPIO Pin Code Setup
GPIO Libraries
GPIO.setmode(pin identification type) | Sets the GPIO mode; defines how pins are called (GPIO.BCM or GPIO.BOARD) |
GPIO.setup(port/pin, GPIO.OUT or GPIO.IN) | Sets the specific GPIO pin for output or input |
GPIO.output(port/pin, 1/HIGH/True or 0/LOW/False) | Sets an output pin to a specific state |
GPIO.input(port/pin) | Reads the data from an input pin |
GPIO Commands
Python
Loops
Ultrasonic Sensor
Ultrasonic Wiring & Code
Coding:
from gpiozero import DistanceSensor
sensor = DistanceSensor(echo=pin, trigger=pin)
Sonic Pi
Sonic Pi Commands
play note[i] | Plays a note |
sleep | Delay function/break |
live_loop: listen do | Loops the note pattern following it, must be named |
use_real_time | Uses real time data as the instrument type… plz don’t ask more about it |
sync “python file path” | Connects a variable to a python program |
EG Raspberry Pi Workshop
EG1003 | Presented by Prototyping
Activity
Make your own Theremin using a Raspberry Pi!
Activity - Coding Instructions
In Python,
In Sonic Pi,
Activity - Circuit
Solution