Python: Extracting json and inserting into sqllite3

This is an interesting project that combining python, json and sqllite to extract, store and processing the data.

The first part are recreating the required tables. Second, part is to read and extract the roster1 json file and capturing the records and arranging them in columns (name, title and role). Nowthat we have the records for all 3 columns and inserting them into all dedicated tables.

Codes are presented in screenshots on purpose to deter from easy google searching for solution as this is a course assignment.

Here is an example of how does the role table looks like.



What I learned here are the embedded SQL in the executescript and the anchoring of the binding variables.  With this simple algorithm and know-how, I can do a lot of more complicated applications.

Python: Raspberry Pi: Adding Button to control LED blinking

Second Project

This is an extension of the first project where letting the python to control the LED blinking. Instead of that, I am going to a physical button to control the LED blinking instead.

Requirements are, when button not pressed, the LED blinks and when the button pressed, the LED lid continuously.

This project is slightly trickier as more wires involved but not terribly bad. Just be cautious of where the wires go.

I am rewiring everything from the first project as I need to cram the LED and the button in the tiny breadboard.

My new pin assignments are the following
pin # 27: LED
pin # 4 :  Button

Picture of the breadboard




Code:




https://youtu.be/UARP5Cuh4FY

Python: Raspberry Pi: First project: LED Blinking

First project


This is an easy project that using the Raspberry Pi GPIO 40 pin to control the LED blinking with Python GPIO library.

I would not be going through the process of putting the wires together on the breadboard. Picture tells it all. Just remember to ground it and have a resistor.



I am using pin 4 for the LED

Code:


import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
while True:
    GPIO.output(24, True)
    print "Led On"
    time.sleep(3)
    GPIO.output(4, False)
    print "Led Off"
    time.sleep(2)