Arduboy Documentation

Text

There is nothing particularly special about the text printing. You can create your own font and draw it as bitmaps onto the screen if you wish.

The drawChar function

The Arduboy class has a drawChar function which can be used, but it is fairly "low level." It draws one character at a time, with the specified location, color, background, and size arguments as shown below:

arduboy.drawChar(10, 10, 'A', WHITE, BLACK, 1);

As it requires all these arguments and doesn't handle more than one character at once, it is better to use the higher-level functions covered next.

Printing numbers and strings

The Arduboy class can handle text size, wrapping, and writing out multiple characters in a row, as one might expect. Using it is as simple as doing the following:

arduboy.print("Byte my shiny metal case!");

Line breaks in strings can be achieved by printing \r\n inside a string or using the println function to add a line break afterwards:

arduboy.println("Hey");
arduboy.print("I need\r\na break");

The print function can also take numbers and an optional formatting parameter. If no formatting parameter is given the default is "decimal" (base 10).

arduboy.println(42);
arduboy.print(66, HEX);

Setting the text location and wrapping

The setTextCursor function tells the Arduboy instance where to draw the text. If you set wrapping to true, when the text reaches the right edge of the screen it will move down a line and continue from the left edge.

arduboy.setWrap(true);
arduboy.setTextCursor(10, 10);
arduboy.print("Byte my shiny metal case!");

Setting the text size

The setTextSize function lets us control the size of text, and is a multiplier of the base font size. A value of two means it should draw the text twice as large. The function only accepts integer values.

arduboy.setTextSize(2);
arduboy.print("Twice as big");