You may easily achieve using 300 of the 320 horizontal pixels with the following changes to your original code:
Make line 12 of code in post #25 look like this:
var xi = 6, xd = xi - 1;
...and line 204 like this:
getPattern(); var x = 0;
...and line 204 like this:
LCD.fillRect(x,0,x+xd,240); x += xi;
Using all of the 320 pixels is a bit a mess and may slow down the execution to the point where you cannot achieve 20 cycles per second anymore. But you may give it a try:
Make line 12 of code in post #25 look like this:
var xi = 320 / rgb.length, xd = xi - 1;
...and line 204 like this:
getPattern(); var x = 0;
...and line 204 like this:
x = i * xi; LCD.fillRect(Math.floor(x),0,Math.floor(x+xd),240);
Just for my curiosity - and help you with the generic code that maximizes dynamically the display size of the LEDs.
A) Do you know the number pixels your display has horizontally? ...I assume it is 320.
B) Do you know the number pixels your display has vertically? ...I assume it is 240.
C) Do you know in which corner (x,y) = (0,0) is?
The answer for C) is easy to find out. It should be sufficient to enter in the console pane of the Espruino Web IDE (left hand pane) the following line:
LCD.setColor(1,0,0); LCD.fillRect(0,0,200,100);
This draws and filled rectangle that is double as wide as high in the corner where 0,0 is.
Looking forward to hear from you about - hopefully - success!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@GarretL, your pic helps a lot.
You may easily achieve using 300 of the 320 horizontal pixels with the following changes to your original code:
Make line 12 of code in post #25 look like this:
...and line 204 like this:
...and line 204 like this:
Using all of the 320 pixels is a bit a mess and may slow down the execution to the point where you cannot achieve 20 cycles per second anymore. But you may give it a try:
Make line 12 of code in post #25 look like this:
...and line 204 like this:
...and line 204 like this:
Just for my curiosity - and help you with the generic code that maximizes dynamically the display size of the LEDs.
A) Do you know the number pixels your display has horizontally? ...I assume it is 320.
B) Do you know the number pixels your display has vertically? ...I assume it is 240.
C) Do you know in which corner (x,y) = (0,0) is?
The answer for C) is easy to find out. It should be sufficient to enter in the console pane of the Espruino Web IDE (left hand pane) the following line:
This draws and filled rectangle that is double as wide as high in the corner where 0,0 is.
Looking forward to hear from you about - hopefully - success!