Skip to content

Instantly share code, notes, and snippets.

from gpiozero import LED
from signal import pause
green = LED(2)
yellow = LED(3)
green.blink()
yellow.blink()
pause()
@uktechreviews
uktechreviews / spiderman.py
Created August 2, 2017 07:33
Spiderman twitter monitor
from twython import Twython, TwythonError
from blinkt import set_pixel, show
import blinkt
import time
import urllib2
APP_KEY = '' #Enter your twitter information here
APP_SECRET = ''
ACCESS_TOKEN= ''
def check_answer(expected):
while True:
if sensor.touch_status_changed():
sensor.update_touch_data()
if sensor.is_new_touch(expected):
if expected !=99:
print ("Correct")
state = True
return state
break
####################################################################################
#This quiz is based on sample Bare conductive code - see licence information below#
####################################################################################
# #
# Bare Conductive Pi Cap #
# ---------------------- #
# #
# simple-touch.py - simple MPR121 touch detection demo with stdout output #
# #
# Written for Raspberry Pi. #
import time
import mcpi.minecraft as minecraft
import mcpi.block as block
import random
import math
mc=minecraft.Minecraft.create()
safe = False
@uktechreviews
uktechreviews / decay.py
Created March 8, 2017 12:58
null created by uktechreviews - https://repl.it/GMTL/1
from random import *
particles = []
total = 100000
while (total > 1) :
for i in range (total):
face = randint(1,6)
particles.append(face)
for items in particles:
if items == 6:
@uktechreviews
uktechreviews / radioactive_decay.py
Last active July 30, 2017 12:58
Modelling radioactive decay
#!/usr/bin/env python
from random import randint
particles = [] ## create an empty list
results = [] ## create a blank list
max_count = 100 ## start with this number of cubes
while (max_count > 1) :
for i in range (max_count): ## populate array with random dice throws
from random import randint
particles = [] ## create an empty list
results = [] ## create a blank list for the results
max_count = 100 ## start with this number of cubes
x_series = []
while (max_count > 1) :
for i in range (max_count): ## populate array with random dice throws
@uktechreviews
uktechreviews / gingerbread.py
Created November 12, 2016 14:25
Christmas Python Activities
## Gingerbread house by Spencer Organ
import mcpi.minecraft as minecraft
import mcpi.block as block
mc=minecraft.Minecraft.create()
x,y,z=mc.player.getPos()
x+=2
mc.setBlocks(x,y,z,x+6,y+3,z+6,block.WOOL.id,12)
mc.setBlocks(x+1,y-1,z+1,x+5,y+2,z+5,block.AIR)
mc.setBlocks(x+1,y-1,z+1,x+5,y-1,z+5,block.WOOL.id,1)
@uktechreviews
uktechreviews / weather_station_auto.py
Last active June 2, 2016 07:33
updated weather station for flotilla from Pimoroni
#!/usr/bin/env python3
import flotilla
import time
client = flotilla.Client(
requires={
'seven':flotilla.Matrix,
'two':flotilla.Number,
'one':flotilla.Weather,