Exemplo n.º 1
0
    def __init__(self, port):

        self.port = port
        self.counter = 0
        if helpers.is_raspberry_pi():
            GPIO.setmode(GPIO.BCM)
            GPIO.setup(self.port, GPIO.IN)
            GPIO.add_event_detect(self.port,
                                  GPIO.FALLING,
                                  callback=self.count_up)
Exemplo n.º 2
0
import sys

import pygame
import json
from pygame.locals import *

from classes.menu.menu import Menu
from classes.pre_game.pre_game import PreGame
from classes.race.x86.race_x86 import RaceX86
from classes.race.arm.race_arm import RaceARM
from classes.highscore import Highscore
from classes import helpers

PLATFORM = 'x86'
if helpers.is_raspberry_pi():
    PLATFORM = 'ARM'


class Gldsprnt():
    def __init__(self):
        # PyGame initialisieren
        pygame.init()

        # Display Init
        pygame.display.init()
        display_info = pygame.display.Info()

        # Screen festlegen (Fullscreen aktiviert)
        self.screen = pygame.display.set_mode(
            (display_info.current_w, display_info.current_h),
Exemplo n.º 3
0
 def stop_listening(self):
     if helpers.is_raspberry_pi():
         GPIO.remove_event_detect(self.port)
Exemplo n.º 4
0
 def start_listening(self):
     if helpers.is_raspberry_pi():
         self.counter = 0
         GPIO.add_event_detect(self.port,
                               GPIO.FALLING,
                               callback=self.count_up)