Display single digit

Hey,

I am a very beginner in Ardyboy and coding. I got a problem and I would appreciate your help.
I am trying to print single digit using

arduboy.drawChar(90-2, 40-3, ‘5’, WHITE, BLACK, 1);

but instead of ‘5’ digit I want to put variable there
so I made one:

char letter = “O”;

and I am trying to put it where before was 5:

arduboy.drawChar(90-2, 40-3, “letter”, WHITE, BLACK, 1);

but It doesn’t work.

Is my char variable setup wrong way or I am putting “letter” variable wrong.

Cheers.

Put the character in single quotes and don’t put quotes on letter.

char letter = 'O';
arduboy.drawChar(90-2, 40-3, letter, WHITE, BLACK, 1);
1 Like

Thank you, it works :slight_smile:

I got another question then:
I want to get random number. I am using this:

byte digit = random(1,9);

but it gives me 8 everytime.

I read that I need to setup seed first but I don’t know how.

Thanks :slight_smile:

Put in setup():
arduboy.initRandomSeed();

1 Like

It works!

Again: Thank you, Sir!

1 Like