auto detect gpio library

This commit is contained in:
ohsqueezy 2022-12-18 20:34:22 -05:00
parent 63a7ddf51f
commit 455630509b
3 changed files with 9 additions and 106 deletions

10
NS.py
View File

@ -11,6 +11,13 @@
# This is the main file containing all the pygame code.
import argparse, pathlib, operator, subprocess, sys, os
# Auto-detect GPIO library
try:
import gpio
except ImportError:
pass
from random import randint, choice, random
from math import pi
from copy import copy
@ -239,8 +246,6 @@ class NS(Game, Animation):
# init Pi
if self.pi_enabled():
import gpio
# Initialize GPIO interface
gpio.initialize_gpio()
@ -249,6 +254,7 @@ class NS(Game, Animation):
self.gpio_kill = False
self.gpio_thread = Thread(target=self.read_gpio, daemon=True)
self.gpio_thread.start()
self.gpio_data = gpio.activity()
# init Arduino
elif self.serial_enabled():

2
config
View File

@ -22,7 +22,7 @@ data-exclude = local/, *.pyc, .git*, README, build/, dist/, *.egg-info, *.py, MA
[display]
caption = Scrapeboard
show-framerate = yes
show-framerate = no
framerate-position = 600, 0
dimensions = 800, 450
fullscreen = no

View File

@ -1,103 +0,0 @@
41802 0
41903 0
42153 0
47259 0
48935 0
50940 0
51245 0
51355 0
51372 0
51754 0
52110 0
52736 0
52863 0
53242 0
53715 0
54546 0
54603 0
55707 0
56045 0
56636 0
56732 0
57247 0
57299 0
57326 0
57436 0
57670 0
57885 0
59459 0
60290 0
60440 0
60510 0
60751 0
60824 0
60957 0
61433 0
61677 0
61838 0
62269 0
62562 0
63416 0
64223 0
64412 0
64534 0
64577 0
65496 0
66051 0
66635 0
67401 0
67523 0
68302 0
68541 0
68948 0
69290 0
69510 0
70404 0
70528 0
71138 0
71335 0
71495 0
71627 0
73511 0
73848 0
74455 0
75015 0
75387 0
75646 0
76002 0
76945 0
77434 0
77526 0
77701 0
79705 0
82020 0
82777 0
87726 0
90718 0
91883 0
73379 1
80500 1
81857 1
89673 1
93372 1
93427 1
97111 1
105880 1
107336 1
108024 1
109913 1
111785 1
112993 1
113387 1
114742 1
116102 1
117369 1
117614 1
117744 1
119812 1
120058 1
120493 1
66801 2
85743 2
86038 2
103819 2