Generating random number in virtual terminal

Hi, i have question for you guys. I'm trying to generate some random numbers but my code is OK and virtual terminal is set right. Only problem i have is that when i start program my virtual terminal is typing something like this: (˜˜€f˜˜€˜˜€˜˜€˜˜€f˜˜€˜˜€f˜˜€˜˜€˜˜€˜˜€˜˜€f˜˜€˜˜€˜˜€˜˜€f˜˜)... . Can you help me please?


Please post your code and explain what a virtual terminal is

What makes you think that your code is OK ?

My guess is that you are using .write() (display raw characters) instead of .print() (display the value of a number).

Of course I can't be sure what is wrong without seeing your sketch.

Sorry I forgot on code :slight_smile: and virtual terminal is Serial Monitor. Here is my code:

int randomCislo;

void setup()

void loop()
randomCislo = random(1,6);

Make sure that the serial monitor is set to 9600 Baud.

Yes it is i checked it twice.

Check it again.

The posted code produces the expected column of numbers between 1 and 5 on my Arduino UNO and my MacBook Pro. I can't explain why it is not working on your Arduino with your PC.