Skip to content

Instantly share code, notes, and snippets.

View lesp's full-sized avatar
🏠
Working from home

Les lesp

🏠
Working from home
View GitHub Profile
@lesp
lesp / dice 2
Created September 19, 2014 21:26
Turn off Dice 2
GPIO.output(d2,0)
@lesp
lesp / Play Sound
Created September 19, 2014 21:27
Function to play sound
#Function to play sounds
def play_sound(x):
pygame.mixer.music.load(x)
pygame.mixer.music.play(1)
while pygame.mixer.get_busy() == True:
continue
@lesp
lesp / Dice Roll
Created September 19, 2014 21:28
Dice Roll
#Function to roll dice
def dice():
roll = randint(1,6)
print(roll)
if roll == 1:
GPIO.output(d1,1)
sleep(3)
GPIO.output(d1,0)
elif roll == 2:
GPIO.output(d1,1)
@lesp
lesp / Main Loop
Created September 19, 2014 21:29
Main Loop
while True:
if GPIO.input(r13) == True:
print("button pressed")
sleep(0.5)
play_sound(ladder)
elif GPIO.input(r39) == True:
print("button pressed")
sleep(0.5)
play_sound(ladder)
elif GPIO.input(r67) == True:
@lesp
lesp / start the game
Created September 22, 2014 06:35
Start the game
sudo python testme.py
@lesp
lesp / raspi-config
Created September 22, 2014 06:40
raspi-config
sudo raspi-config
@lesp
lesp / flash.py
Created September 24, 2014 19:11
Unicorn HAT
import ws2812
from time import sleep
from random import randint
ws2812.init(64)
"""
while True:
for i in range(0,64):
ws2812.setPixelColor(i,128,64,64)
ws2812.show()
@lesp
lesp / Pi
Created October 17, 2014 11:06
Jar Jar Guide
Hello
Right, well the goal as I see it is to create a master card that contains all the packages that you need?
if that is the case, create a card on a Pi, that has all the programs that you want.
Using software such as dd or win32disk imager create a cloned image of that card.
Using the same software copy that image to each of the cards that you wish to use.
@lesp
lesp / Santa_imports
Created November 6, 2014 15:07
Imports for the Santa Trap
#Import Modules
import time
import datetime
import RPi.GPIO as GPIO
import pygame
import picamera
from random import choice
@lesp
lesp / Santa_Pygame
Created November 6, 2014 15:12
Setting up Pygame
#Setup Pygame
pygame.init()
pygame.mixer.init()