Last active
August 29, 2015 14:03
-
-
Save onewland/1b5223fa19aad8cc036b to your computer and use it in GitHub Desktop.
red screen, "eat the rich" on button press
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import RPi.GPIO as GPIO | |
import time | |
pygame.init() | |
channel = 18 | |
red = pygame.Color(255,50,50) | |
white = pygame.Color(255,255,255) | |
black = pygame.Color(0,0,0) | |
width = 1824 | |
height = 984 | |
font = pygame.font.Font(None, 256) | |
text = font.render("EAT THE RICH", 1, white, red) | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) | |
screen = pygame.display.set_mode((width, height), pygame.FULLSCREEN) | |
pygame.mouse.set_visible(False) | |
while 1: | |
GPIO.wait_for_edge(channel,GPIO.FALLING) | |
screen.fill(red) | |
screen.blit(text, (100,100)) | |
pygame.display.update() | |
GPIO.wait_for_edge(channel,GPIO.RISING) | |
time.sleep(1) | |
screen.fill(black) | |
pygame.display.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment