PeterH:
yerzhik:
What is the problem?What you are trying to do is trivially simple and could be done in a couple of lines of code using the Arduino libraries.
The approach you're using attacks the hardware directly, which is much harder to implement. Why don't you simply do it the easy way?
You were right. I have already made it by changing the SerialEvent example.
But I was wondering why that strange things happened.
And if you can do this thing in a hard way - it means you understand the arduino quite well.
By the way the thing which is done in that code using the hard way, regarding the USB communication, what should be read from the datasheet in order to understand it? There are several chapters but I dont know which one exactly to read: the SPI, USART or USART in SPI mode?