Skip to content

Instantly share code, notes, and snippets.

View dobrienSTJ's full-sized avatar

Daniel O'Brien dobrienSTJ

View GitHub Profile
@ethanshine1234
ethanshine1234 / open.py
Last active October 25, 2016 09:46
STJLOL-ES-open project
from time import sleep
lesso = ['lesson 1', 'lesson 2', 'lesson 3', 'lesson 4', 'lesson 5', 'lesson 6', 'end task']
def lesson1():
print("Here you will learn the basics")
sleep(1)
print("print will allow the computer to say stuff")
sleep(1)
print("Here is an example: print(\"Hello\")")
@MrDMurray
MrDMurray / 2car.py
Last active December 6, 2016 10:15
STJLOL-DMU: Controls an RC car with a Raspberry Pi
import RPi.GPIO as GPIO
from time import sleep
import readchar
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3, GPIO.OUT) #reverse
GPIO.setup(5, GPIO.OUT) #forward
GPIO.setup(8, GPIO.OUT) #left
@MrDMurray
MrDMurray / light.py
Last active January 10, 2017 10:40
STJLOL-DMU Basic GPIO
#the setup
#Reminder: Do you have a resistor in series with your LED? If you don't you will kill the LED and damage the RPi.
import RPi.GPIO as GPIO #lets you use GPIO
from time import sleep #lets you use sleep(2) as a timer for the lights
GPIO.setmode(GPIO.BCM) #tells the program what labeling system to use. We'll use BCM
#because that's what it used on your blue cobbler on your breadboard.
GPIO.setup(17, GPIO.OUT) #tells the pi exactly what GPIO you'll be using
@dobrienSTJ
dobrienSTJ / light.py
Created December 6, 2016 10:03 — forked from MrDMurray/light.py
STJLOL-DMU Basic GPIO
#the setup
import RPi.GPIO as GPIO #lets you use GPIO
from time import sleep #lets you use sleep(2) as a timer for the lights
GPIO.setmode(GPIO.BOARD) #tells the program what labeling system to use
GPIO.setup(17, GPIO.OUT) #tells the pi exactly what number pin you'll be using
@daniel-obrien
daniel-obrien / MotorsNew.py
Last active January 12, 2017 17:57
NEW MOTORS!!
while True:
import RPi.GPIO as GPIO #GPIO Libraries
from time import sleep #Sleep Functions
GPIO.setmode(GPIO.BCM) #Setting Up
GPIO.setup(23, GPIO.OUT)#Right Motor Forwards
GPIO.setup(24, GPIO.OUT)# Backwards
GPIO.setup(17, GPIO.OUT)#Left Motor Backwards
GPIO.setup(27, GPIO.OUT)# Forwards
@MrDMurray
MrDMurray / roverdover.py
Last active March 2, 2017 09:16
Roverdover STJLOL
import RPi.GPIO as GPIO #lets you use GPIO
from time import sleep #lets you pause the program
GPIO.setmode(GPIO.BOARD) #chooses BOARD instead of BCM
GPIO.setup(11, GPIO.OUT) #sets up the motors
GPIO.setup(13, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
@dobrienSTJ
dobrienSTJ / s.py
Last active March 7, 2017 10:38
IR Rangefinder Rover
#Only in PYTHON2.7
import RPi.GPIO as GPIO #GPIO Libraries
from time import sleep #Sleep Functions
import readchar #keyboards
GPIO.setwarnings(False)#Blocks error warnings
GPIO.setmode(GPIO.BCM) #Setting Up
GPIO.setup(23, GPIO.OUT) #back right
GPIO.setup(24, GPIO.OUT) #front right
@MrDMurray
MrDMurray / sensory.py
Created March 1, 2017 23:00
STJLOL Sensory
import RPi.GPIO as GPIO
from time import sleep
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
@MrDMurray
MrDMurray / sensorymotors.py
Last active March 7, 2017 10:10
STJLOL Sensory Stuff
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(24, GPIO.OUT) # motors setup
GPIO.setup(17, GPIO.OUT)
GPIO.setup(27, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
@MrDMurray
MrDMurray / FakeNews.py
Last active May 30, 2018 09:09
FakeNews.py
from urllib.request import urlopen
from xml.dom import minidom
import collections
# extract the headlines from the feed
def extractString(doc):
str = ""
for node in doc.getElementsByTagName('channel'):
for title in node.getElementsByTagName('title'):
str = str + title.firstChild.data + "\n"