Function to show a scrolling message on the face plate


#1

Hello

Since the face plate can be used to make the mBot “talk” back to my kids, I was trying to make a function that would take a message and take care of the scrolling.

But mBlock translates this into

void ShowMessage(String msg)
{
x = 0;

while(!((x) > (10)))
{
    ledMtx_4.clearScreen();
    ledMtx_4.setColorIndex(1);
    ledMtx_4.setBrightness(6);
    ledMtx_4.drawStr(x,7-0,"msg");
    x += -1;
    delay(1000*0.2);
}

}

Note the line

ledMtx_4.drawStr(x,7-0,"msg");

Which makes “msg” always to be shown on the face plate.

If I edit the file manually and remove the quotes, then I get a compilation error because drawStr expects a const *char, instead of a String.

Any ideas on how to resolve this?
As a feature request, I think the “Show face” block should make things easier and take care of the scrolling for us.

Thanks!


#2