Trying to scroll horizontally


(Luey Hewis) #1

So I’m just starting to learn programming my Arduboy and when I try to scroll horizontally it only moves the first row not the whole screen.
I need help on where the problem could be, this is the code I use for this at the moment:

void setup()
{
arduboy.beginNoLogo();
arduboy.setCursor(0,0);
arduboy.print(“Blank”);
arduboy.setTextSize(1);
arduboy.display();
arduboy.invert(true);
}

int x = 0, y = 1;

void loop ()
{
if (arduboy.pressed(UP_BUTTON)) {
y+=5;
} else if (arduboy.pressed(DOWN_BUTTON)) {
y-=5;
} else if (arduboy.pressed(LEFT_BUTTON)) {
x+=1;
} else if (arduboy.pressed(RIGHT_BUTTON)) {
x-=1;
}
arduboy.clear();
arduboy.setCursor(x,y);
arduboy.println(“Text1\r”);
arduboy.print(“Text1\n”);
arduboy.print(“Text1\n”);

arduboy.println(“Text2\r”);
arduboy.print(“Text2\n”);
arduboy.print(“Text2\n”);

arduboy.println(“Text3\r”);
arduboy.print(“IText3\n”);
arduboy.print(“Text3\n”);
}


(Simon) #2

The println() command returns the cursor to the left most pixel (x = 0).


(Luey Hewis) #3

Tried to with the normal arduboy.print command, which isn’t working either, now there are no breaks at all, it’s just one text. Or did I do it wrong?


(Pharap) #4

arduboy.println() and arduboy.print('\n') behave the same.
Whenever the Arduboy2 class encounters a newline it goes back to x = 0.

You’d have to manually set the x instead of using a newline.


(Luey Hewis) #5

Yeah ok I’m not going to do that, probably just trying to keep the texts short. Thanks for your help anyways!