-
• #2
The issue is that you're using 1 bit per pixel, so 8 bits are in each byte - and you're trying to retrieve bytes. If you used:
var g = Graphics.createArrayBuffer(5,7,8, {zigzag:true});
Then I'm pretty sure that'll work fine. I'm not sure what you're planning but you may find you don't want the
zigzag:true
either, as that will make alternate scanlines reversed. -
• #3
Hye, Gordon
I need of a byte array (0,1) (pixel OFF, pixel ON) row by raw.
the matrix is on/off not in 8bits.
or i do not understand what is an arrayBuffer...in your example it is suppose to do that (it's exactly what i need to transfer to my display via serial):
//0,0,0,0,0,0,0,0 //0,1,1,0,0,0,1,1 //0,1,1,0,0,0,1,1 //0,0,1,1,0,1,1,0 //0,0,0,1,1,1,0,0 //0,0,1,1,0,1,1,0 //0,1,1,0,0,0,1,1 //0,1,1,0,0,0,1,1
it does not... why?
-
• #4
Graphics.prototype.print = function() { for (var y=0;y<this.getHeight();y++) console.log(new Uint8Array(this.buffer,this.getWidth()*y,this.getWidth()).toString()); }; var g = Graphics.createArrayBuffer(8,8,8); g.setColor(1); g.drawString("X",0,0); g.print();
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v95.43 Copyright 2017 G.Williams >1,0,1,0,0,0,0,0 1,0,1,0,0,0,0,0 0,1,0,0,0,0,0,0 1,0,1,0,0,0,0,0 1,0,1,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0
I added
.toString
because now it outputsnew Uint8Array([0,0,0,0,0,0,0,0])
asnew Uint8Array(8)
to save space.And the output is different because the default font has changed.
-
• #5
Hello,
As i enable to control the flipdot hannio' display ( see forum) with an espruino.
I'm trying to communicate to an arduino which control the display.
Spi and i2c are in use in the arduino so i do with serial. It's not really good (i suppose i'm trying comm to fast) but i'm able iniate a com between the boards...
I'm able to transfer array, but at the moment, not the arrayBuffer.Regards
-
• #6
Ahh - try
Serial.println(new Uint8Array(...).toString())
. I'd have thought that would output something like0,0,1,0,0,1,0,0\r\n
that should be pretty easy to receive. -
• #7
yes, great the use of println()... there is a final CR, easy to detect to call the refresh display function.
thanks.é.
Hello,
i'm trying to work with arrayBuffer but i'm bad...
I'm using exemple in the graphics library at Internal Use
when i use the
g.print()
it does not produce an array of 0 and 1...but that...
i would like to send via Serial an array of row and colum as in the exemple of
print()
thanks for you help