Git Product home page Git Product logo

Comments (4)

alankrantas avatar alankrantas commented on July 1, 2024 1

Yeah, I totally forgot that the characters have their own widths. My bad.

I made a update with a new block. Test OK on my own device. Re-import the driver and it should be there.

microbit-screenshot

from pxt-max7219_8x8.

alankrantas avatar alankrantas commented on July 1, 2024

The offset option in the "Display text" block allows you to print texts started at any place on the display.

A 4x 8x8 matrix has 4x8=32 columns, so offset can be set as 0 to 31 (0 = start for the first column from the left). Store your text in a variable, get its length, and set the offset as (31 - length).

microbit-screenshot

You can also utilize this to do some animation effects, like scrolling texts from right to left, back and forth or blinking and stuff.

Add a new block is simple enough - but there would be adding more lines of code than above (I would have to define a new block as well). Since this driver already used up a lot of memory space of micro:bit, I am hesitate to do that now. (Maybe not until the new version of micro:bits become widely used.)

from pxt-max7219_8x8.

deradam avatar deradam commented on July 1, 2024

Hi Alan, thanks for the promt answer, very much appreciated.

I checked your proposal and I am not sure if I am getting it right or wrong but it doesn't work for me.

So the when I calculate 31 - length of text - let's say "10 cm", then length ("10 cm") is 5. 31 -5 is 26. Offset 26 however is not enought to show the string I want to show.

I guess I would need to have access to the width of the text instead of the length. I have seen that you have such a matrix inside your source code. Is there any way to get access from outside to this width array?

Cheers and greetings from Germany :)

from pxt-max7219_8x8.

deradam avatar deradam commented on July 1, 2024

Hi @alankrantas,
I was only able to test your fixes now. And what should I say, works like a charm! Thanks a lot for the awesome and speedy support!
Cheers! 🥇

from pxt-max7219_8x8.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.