interface with floppy and play melody

Hi,
it took me a couple of hours to get this up and running....including ripping out the floppy drive from my PC :grin:

// D4 to pin 14
// D3 to pin 16 
// D6 to pin 18
#define Dir 3
#define Step 6
#define Sel 4
void setup() {
  pinMode(Dir, OUTPUT); 
  pinMode(Step, OUTPUT);
  pinMode(Sel, OUTPUT);
  digitalWrite(Sel, HIGH);
  initHead();  // move header half way
}

void initHead() {
  digitalWrite(Step, HIGH);
  digitalWrite(Dir, HIGH); 
  doSteps(80, 1911);  // move header to start position wherever it is, 80 steps at ~261 step/s
  digitalWrite(Dir, LOW);
  doSteps(40, 1911);
  delay(1000);
}

void doSteps(int steps, int stepDelay) {
  digitalWrite(Sel, LOW);
  for(int i=0;i<steps; i++) {
    digitalWrite(Step,LOW); 
    delayMicroseconds(stepDelay);
    digitalWrite(Step,HIGH); 
    delayMicroseconds(stepDelay);

  }
  digitalWrite(Sel, HIGH);
}

void vibe(int count, int period) {
  for(int l=0;l<count; l++) {
    digitalWrite(Dir, HIGH);
    doSteps(1, period);
    digitalWrite(Dir, LOW);
    doSteps(1, period);
  }
}
void loop() {
  vibe(100, 851);
  delay(250);
  vibe(110, 756);
  delay(250);
  vibe(85, 955);
  delay(250);
  vibe(30, 3822);
  delay(250);
  vibe(90, 1275);
  delay(250);
  while(true);
}

Texy