constant stream of bits

I was wondering if it is possible to write a program that can send a continuous stream of data, 101010101..., and if it was possible to change the bits per second, for example from 1 Mb/s or 10 Mb/s?

10MB/s with a simpleminded program might be hard, but in general this would be easy.

A simple on/off at varying frequencies could be done with a suitably-configured hardware timer.

You could use the SPI port to generate a continuous bit stream. 10MBps will be a stretch though on most Arduinos.


Do you really mean just a square wave, in that case use PWM form a timer?