Compare commits
5 Commits
11d9a58a55
...
4e357a2faa
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e357a2faa | |||
| aedad94aaf | |||
| 4bbc0563f6 | |||
| 53105d5935 | |||
| 6bd6dd2e1c |
@@ -20,7 +20,7 @@
|
||||
"columns": 32,
|
||||
"stride": 8,
|
||||
"fps": 10,
|
||||
"rotation" : 0
|
||||
"rotation" : 180
|
||||
},
|
||||
"Boot": {
|
||||
"intensity": 0.03
|
||||
|
||||
@@ -12,7 +12,7 @@ class DemoScene:
|
||||
self.display = display
|
||||
self.intensity = 32
|
||||
self.x_pos = 0
|
||||
self.text = 'example'
|
||||
self.text = 'DoubleU LaMatrix'
|
||||
if not config:
|
||||
return
|
||||
if 'intensity' in config:
|
||||
|
||||
@@ -75,13 +75,8 @@ class LedMatrix:
|
||||
# The LEDs are laid out in a long string going from north to south,
|
||||
# one step to the east, and then south to north, before thxy e cycle
|
||||
# starts over.
|
||||
stride = self.stride
|
||||
phys_addr = int(((x)%self.panelcolumn) + ((y)*self.panelcolumn) + (self.round_down((x)/self.panelcolumn) * self.panelcolumn * self.panelcolumn))
|
||||
|
||||
# if x & 1:
|
||||
# phys_addr += stride - 1 - y
|
||||
# else:
|
||||
# phys_addr += y
|
||||
return phys_addr
|
||||
|
||||
def get_pixel(self, x, y):
|
||||
|
||||
3
main.py
3
main.py
@@ -44,9 +44,10 @@ else:
|
||||
try:
|
||||
# If the rpi_ws281x Python module is available, then use that...
|
||||
from raspberrypihal import RaspberryPiHAL as HAL
|
||||
except:
|
||||
except Exception as e:
|
||||
# ...else assume that there's an MCU (driving the display) connected
|
||||
# to a serial port
|
||||
print('HAL: failed: {}'.format(e.args[0]))
|
||||
from arduinoserialhal import ArduinoSerialHAL as HAL
|
||||
|
||||
gc.collect()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
q# HAL for Raspberry Pi with https://github.com/rpi-ws281x/rpi-ws281x-python
|
||||
# HAL for Raspberry Pi with https://github.com/rpi-ws281x/rpi-ws281x-python
|
||||
# See https://github.com/jgarff/rpi_ws281x for more details on this library.
|
||||
#
|
||||
# The below code assumes the LED strip is connected to GPIO 18 (PCM CLK)
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
from rpi_ws281x import PixelStrip, Color
|
||||
from gpiozero import Button
|
||||
import utime
|
||||
import os
|
||||
|
||||
# LED strip configuration:
|
||||
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
|
||||
@@ -37,7 +37,7 @@ class RaspberryPiHAL:
|
||||
self.right_button.when_pressed = self.button_irq_press
|
||||
self.left_button.when_released = self.button_irq
|
||||
self.right_button.when_released = self.button_irq
|
||||
self.suspend_host_pin.when_held = self.button_irw_held
|
||||
#self.suspend_host_pin.when_held = self.button_irq_held
|
||||
self.left_down_t = 0
|
||||
self.right_down_t = 0
|
||||
self.button_state = 0
|
||||
|
||||
Reference in New Issue
Block a user