read a line of an ArrayBuffer

Posted on
  • Hello,

    i'm a bit newb with arrayBuffer...
    i use a flipdot display compose with 1 line of 7 points and a block of 7 lines of 7 points.
    I need an array of 8x8 to drawString(t,x,y)

    var g = Graphics.createArrayBuffer(8,8,1);
    

    How to access of the data stored in the first line of the array?
    g[0] ?
    and the rest of the buffer?

    sorry for this basic question but i don't know how to use this object.

  • No problem - by default g.buffer is an untyped arraybuffer, so ideally you make it into something typed:

    var g = Graphics.createArrayBuffer(8,8,1);
    // ...
    var a = new Uint8Array(g.buffer);
    a[0]
    // you can still change 'g' and the values in 'a' will change too
    
  • I've done this...
    i'm waiting the postman with the 7x1 display for testing... (monday or later)

      g = Graphics.createArrayBuffer(8,8,1);
      g.setFont4x6();
      g.drawString(texte,compteur,0);
      a = new Uint8Array(g.buffer);
      // ecran 1x7
      Serial1.write([0x80,0x89,Adress],a[0],[0­x8F]);
      // ecran 7x7
      Serial1.write([0x80,0x87,Adress2],a[1],a­[2],a[3],a[4],a[5],a[6],a[7],[0x8F]);
    
  • Yes, that seems fine. Just FYI - you don't need g.setFont4x6(texte,compteur,0); - you can just write g.setFont4x6();

  • @Gordon oups, you're rigth.
    It's a bad cut/past.
    I've modifying the code
    Thanks

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

read a line of an ArrayBuffer

Posted by Avatar for Mrbbp @Mrbbp

Actions