Use more leds, too slow, need to try with real Serial
parent
460c89f459
commit
52835c9b8c
|
@ -64,8 +64,8 @@
|
||||||
// are arranged. If 0, each strip begins on the left for its first row,
|
// are arranged. If 0, each strip begins on the left for its first row,
|
||||||
// then goes right to left for its second row, then left to right,
|
// then goes right to left for its second row, then left to right,
|
||||||
// zig-zagging for each successive row.
|
// zig-zagging for each successive row.
|
||||||
#define LED_WIDTH 50 // number of LEDs horizontally
|
#define LED_WIDTH 500 // number of LEDs horizontally
|
||||||
#define LED_HEIGHT 1 // number of LEDs vertically (must be multiple of 8)
|
#define LED_HEIGHT 8 // number of LEDs vertically (must be multiple of 8)
|
||||||
#define LED_LAYOUT 0 // 0 = even rows left->right, 1 = even rows right->left
|
#define LED_LAYOUT 0 // 0 = even rows left->right, 1 = even rows right->left
|
||||||
|
|
||||||
// The portion of the video image to show on this set of LEDs. All 4 numbers
|
// The portion of the video image to show on this set of LEDs. All 4 numbers
|
||||||
|
@ -77,8 +77,8 @@
|
||||||
// or device names are assigned to each Teensy 3.0 by your operating system.
|
// or device names are assigned to each Teensy 3.0 by your operating system.
|
||||||
#define VIDEO_XOFFSET 0
|
#define VIDEO_XOFFSET 0
|
||||||
#define VIDEO_YOFFSET 0 // display entire image
|
#define VIDEO_YOFFSET 0 // display entire image
|
||||||
#define VIDEO_WIDTH 10
|
#define VIDEO_WIDTH 100
|
||||||
#define VIDEO_HEIGHT 10
|
#define VIDEO_HEIGHT 100
|
||||||
|
|
||||||
//#define VIDEO_XOFFSET 0
|
//#define VIDEO_XOFFSET 0
|
||||||
//#define VIDEO_YOFFSET 0 // display upper half
|
//#define VIDEO_YOFFSET 0 // display upper half
|
||||||
|
@ -91,8 +91,8 @@
|
||||||
//#define VIDEO_HEIGHT 50
|
//#define VIDEO_HEIGHT 50
|
||||||
|
|
||||||
|
|
||||||
//const int ledsPerStrip = LED_WIDTH * LED_HEIGHT / 8;
|
const int ledsPerStrip = LED_WIDTH * LED_HEIGHT / 8;
|
||||||
const int ledsPerStrip = 700;
|
//const int ledsPerStrip = 1000;
|
||||||
|
|
||||||
DMAMEM int displayMemory[ledsPerStrip*6];
|
DMAMEM int displayMemory[ledsPerStrip*6];
|
||||||
int drawingMemory[ledsPerStrip*6];
|
int drawingMemory[ledsPerStrip*6];
|
||||||
|
|
|
@ -6,9 +6,12 @@ gamma = 1.7
|
||||||
brightness = 4
|
brightness = 4
|
||||||
errorCount = 0
|
errorCount = 0
|
||||||
framerate = 30
|
framerate = 30
|
||||||
dimension = 0
|
dimension = 0
|
||||||
|
|
||||||
long_line = True
|
# TODO: test with real serial
|
||||||
|
# https://www.pjrc.com/teensy/td_uart.html
|
||||||
|
|
||||||
|
long_line = False
|
||||||
|
|
||||||
ledSerial = None
|
ledSerial = None
|
||||||
data = None
|
data = None
|
||||||
|
@ -33,7 +36,7 @@ def serialConfigure(portName):
|
||||||
println("Is it really a Teensy 3.0 running VideoDisplay?")
|
println("Is it really a Teensy 3.0 running VideoDisplay?")
|
||||||
errorCount += 1
|
errorCount += 1
|
||||||
return
|
return
|
||||||
|
|
||||||
param = line_serial.split(",")
|
param = line_serial.split(",")
|
||||||
if (len(param) != 12):
|
if (len(param) != 12):
|
||||||
println("Error: port " + portName + " did not respond to LED config query")
|
println("Error: port " + portName + " did not respond to LED config query")
|
||||||
|
@ -42,7 +45,7 @@ def serialConfigure(portName):
|
||||||
|
|
||||||
def image2data(data):
|
def image2data(data):
|
||||||
offset = 3
|
offset = 3
|
||||||
pixel_nb = 0
|
pixel_nb = 0
|
||||||
for x in range(0, height):
|
for x in range(0, height):
|
||||||
pixel_line = pixels[pixel_nb:pixel_nb+width]
|
pixel_line = pixels[pixel_nb:pixel_nb+width]
|
||||||
if long_line and pixel_nb/width%2 == 1:
|
if long_line and pixel_nb/width%2 == 1:
|
||||||
|
@ -77,7 +80,7 @@ def colorWiring(c):
|
||||||
def send_serial():
|
def send_serial():
|
||||||
image2data(data)
|
image2data(data)
|
||||||
ledSerial.write(data)
|
ledSerial.write(data)
|
||||||
|
|
||||||
def prepare_data():
|
def prepare_data():
|
||||||
global data
|
global data
|
||||||
data = jarray.zeros(dimension * 24 + 3, "b")
|
data = jarray.zeros(dimension * 24 + 3, "b")
|
||||||
|
@ -89,10 +92,10 @@ def prepare_data():
|
||||||
def setup():
|
def setup():
|
||||||
global gammatable
|
global gammatable
|
||||||
global dimension
|
global dimension
|
||||||
size(8, 5)
|
size(500, 8)
|
||||||
dimension = width * height
|
dimension = width * height
|
||||||
frameRate(framerate)
|
frameRate(framerate)
|
||||||
serialConfigure("/dev/ttyACM0")
|
serialConfigure("/dev/ttyACM0")
|
||||||
if (errorCount > 0):
|
if (errorCount > 0):
|
||||||
exit()
|
exit()
|
||||||
gammatable = [int((math.pow(i / 255.0, gamma) * 255.0 + 0.5) * brightness) for i in range(0, 256)]
|
gammatable = [int((math.pow(i / 255.0, gamma) * 255.0 + 0.5) * brightness) for i in range(0, 256)]
|
||||||
|
@ -101,6 +104,7 @@ def setup():
|
||||||
for i in range(dimension):
|
for i in range(dimension):
|
||||||
pixels[i] = color(0, 0, 0)
|
pixels[i] = color(0, 0, 0)
|
||||||
updatePixels()
|
updatePixels()
|
||||||
|
send_serial()
|
||||||
|
|
||||||
def draw():
|
def draw():
|
||||||
global current_px
|
global current_px
|
||||||
|
@ -112,6 +116,6 @@ def draw():
|
||||||
updatePixels()
|
updatePixels()
|
||||||
if current_px == len(pixels) - 1:
|
if current_px == len(pixels) - 1:
|
||||||
current_px = 0
|
current_px = 0
|
||||||
else:
|
else:
|
||||||
current_px += 1
|
current_px += 1
|
||||||
send_serial()
|
send_serial()
|
||||||
|
|
Loading…
Reference in New Issue