Small problem with laser-based persistance-of-vision system

The project is just a laser rapidly switching on and off pointed at a spinning mirror. I'm using the Digital > BlinkWithoutDelay example sketch and have the delay set to zero. The problem is the dashes created by the spinning motor are still not short enough. I can either fix this by getting a lower rpm motor or getting the laser to blink faster. Am I already at the limit of the 16MHz clock speed by setting the delay to 0 in the example sketch?

Am I already at the limit of the 16MHz clock speed by setting the delay to 0 in the example sketch?

No, you are using millisecond delay as your delay unit. You can get faster than this.
If I were doing this I would use timer 2 to set a PWM frequency, this is steady and can go much faster than the 500 HZ a millisecond toggle will give you.

I'm now using PWM like you suggested. analogWrite(laserPin, 10); for example makes a nice, short dash but I need the short dashes much closer together and I need to be able to control which dashes are there and not there to make a user defined pattern. Am I correct to say that that is not possible with PWM?

What sort of blink timing are you trying to generate i.e. how fast do you need the on/off transitions, and how accurately do you need them timed?

The device (laser pointed at a spinning mirror) will be about 3-4 ft above a 4ft long flat surface and need to project about 90 dots along, and confined within, that 4ft surface. Each dot must be able to be turned on or off individually. I also need to be able to set the individual spacing of each dot relative to the dot beside it. Some dot pairs will be spread out further apart than others.

PWM is close to being fast enough but I can't control the amount of time on AND the amount off time off like I need. Is the arduino just not good enough to do this?

I have no idea. Can you explain all that again please, but this time in terms of the timing requirements? I really don't care how far away the bits are.

analogWrite(laserPin, 10); for example makes a nice, short dash depending on the rpm of the motor.

the value can be 0-255. If "10" is used, it is on for 10 clicks and then off for 245 clicks. I need it to be on 5 clicks, and off 5 clicks, then repeat. Do you see what I mean?

Am I not clear? Is this a really difficult problem to solve?

analogWrite(laserPin, 10); for example makes a nice, short dash depending on the rpm of the motor.

You know the PWM frequency and the duty cycle, so the pulse length should be a simple calculation.

It is a matter of synchronising the PWM output to the motor rotation.
There are many ways of doing this.
One is with a sensor for each rotation, an other is using a phase locked loop to synchronise the motor speed to the PWM frequency.

You can change the PWM frequency to be much faster than the default.

You guys are misunderstanding the current problem a little. I'm not worried about alignment yet. Let me rephrase it this way; I need to figure out what code would give me the absolute shortest, most frequent pulses on an output pin. Imagine a square wave on an oscilloscope. I need to compress that wave as far as the arduino can handle. I need it to blink/pulse as fast as it possibly can.

I need to figure out what code would give me the absolute shortest, most frequent pulses on an output pin.

Direct port manipulation should get you up to a few mega Hertz.
Occasional glitch for timer overflow interrupts, though.

That's cool.. I have no idea what the code is for that though.

Some good search terms though

I found this Arduino Reference - Arduino Reference but the example isn't as helpful as I need it to be.

How helpful do you need it?

So I guess this: DDRD = DDRD | B11111100; would go in setup.. and in the loop, if I want to change pin 7 on and off, I would alternate between PORTD = B10000000; and this: PORTD = B00000000; Is there a way to do that last part with one line of code in the loop instead of using if statements?

You'll want to look into the BitMath tutorial.

To do specifically what you're asking you could just PORTD += B10000000.

Ok. I went from this code, which just produces a solid line:

void setup() {
  DDRD = DDRD | B11111100;
}

void loop()
{
  PORTD += B10000000;
}

to this code which produces a dash that is way too long.

void setup() {
  DDRD = DDRD | B11111100;
}

void loop()
{
  delay(1);
  PORTD += B10000000;
}

How would I delay shorter than that so that I find a middle ground which produces dots right next to each other as opposed to a solid line or long dashes?

You could change the millisecond delay to something shorter.
Maybe a few tens of microseconds?