Python code for using various components with a Pi