Int to String - Led Matrix

Hello Arduino Forum,

I'am working on a cool project using the Arduino uno.. but i have a small problem :blush: I need to get the variable int maanstofverkoop into my char* :astonished:

How do i convert?! i really need the random function.

First, you need to post your code so we can look at it. Please use the # icon on the editor's toolbar.

int maanstofinkoop = random(10,20);

char maanstof[16];
itoa(maanstofinkoop, maanstof, 10);

etc

Can you tell more about the project? the words maanstof an plutonium are at least inspiring ...

LoL :D I'am not working for north korea or something... 8) I'am working on a game called SpaceTrader.. I'am building four trade stations with all kind of fancy stuff and led couters. The game requires Kids to trade and think out a strategy.. Where a planning to play this game with about 40 kids..

I got it working with on string like this now..

int maanstofinkoop = random(10,20);
int maanstofverkoop = random(10,30);
   
char maanstof[16];
itoa(maanstofinkoop, maanstof, 10);

If i want to use two int'er can use just one function?

If i want to use two int'er can use just one function?

If I understand this question, and there's no guarantee that I do, I think you want to use the sprintf() function, instead of two calls to atoi().

I want maanstof to contain both the value's :

maanstofinkoop and maanstofverkoop

I want maanstof to contain both the value's :

maanstofinkoop and maanstofverkoop

sprintf(maanstof, "%d, %d", maanstofinkoop, maanstofverkoop);

will convert the two ints to strings, separated by a comma and a space, and put the result in the char array.

You're my new hero!! it works!!!

Thanks!! Case closed!