Difference between revisions of "Super Mario on floppy-drive"

From Hackerspace ACKspace
Jump to: navigation, search
m (added categories)
 
(5 intermediate revisions by one other user not shown)
Line 6: Line 6:
 
Then, on the end that you normaly connect to your motherboard, find pin 1 (see the red wire)
 
Then, on the end that you normaly connect to your motherboard, find pin 1 (see the red wire)
  
Connect pin 11 & 12 together.<br>
+
Connect pin 13 & 14 together.<br>
 
Connect pins 17 & 19 to ground.<br>
 
Connect pins 17 & 19 to ground.<br>
Connect pin 18 to digital 2 on the arduino<br>
+
Connect pin 18 to digital 3 on the arduino<br>
Connect pin 20 to digital 3 on the arduino<br>
+
Connect pin 20 to digital 2 on the arduino<br>
  
 
== Basic Code ==
 
== Basic Code ==
  
 +
'''NO MARIO TUNE YET'''
 +
 +
  const byte FIRST_PIN = 2;
 +
  const byte PIN_MAX = 3;
 +
 
 
   void setup()
 
   void setup()
 
   {
 
   {
Line 18: Line 23:
 
     pinMode(2, OUTPUT);
 
     pinMode(2, OUTPUT);
 
     pinMode(3, OUTPUT);
 
     pinMode(3, OUTPUT);
 +
    pinMode(13, HIGH);
 
   }
 
   }
 
+
 
 
   void loop()
 
   void loop()
 
   {
 
   {
 
     reset();
 
     reset();
     digitalWrite(2, HIGH);
+
     for (byte s=0;s<180;s++){ // For max drive's position
    delay(20);
+
      for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
    digitalWrite(2, LOW);
+
        digitalWrite(p,HIGH);
 +
        digitalWrite(p,LOW);
 +
      }
 +
      delay(2);
 +
    }
 
   }
 
   }
 
+
 
 
   void reset()
 
   void reset()
 
   {
 
   {
     digitalWrite(3, HIGH);
+
     for (byte s=0;s<80;s++){ // For max drive's position
    digitalWrite(2, HIGH);
+
      for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
    digitalWrite(2, LOW);
+
        digitalWrite(p+1,HIGH); // Go in reverse
    digitalWrite(2, HIGH);
+
        digitalWrite(p,HIGH);
    digitalWrite(2, LOW);
+
        digitalWrite(p,LOW);
    digitalWrite(2, HIGH);
+
        digitalWrite(p+1,LOW);
    digitalWrite(2, LOW);
+
      }
    digitalWrite(2, HIGH);
+
      delay(5);
    digitalWrite(2, LOW);
+
     }
    digitalWrite(2, HIGH);
 
    digitalWrite(2, LOW);
 
    digitalWrite(2, HIGH);
 
    digitalWrite(2, LOW);
 
    digitalWrite(2, HIGH);
 
    digitalWrite(2, LOW);
 
    digitalWrite(2, HIGH);
 
    digitalWrite(2, LOW);
 
    digitalWrite(2, HIGH);
 
     digitalWrite(2, LOW);
 
    digitalWrite(2, HIGH);
 
    digitalWrite(2, LOW);
 
    digitalWrite(2, HIGH);
 
    digitalWrite(2, LOW);
 
    digitalWrite(3, LOW);
 
 
   }
 
   }
 +
 +
[[Category:Arduino]]

Latest revision as of 13:06, 27 August 2015

Interfacing the Floppy Drive with Arduino

Connect the 2nd header of the floppy drive cable to connect to the floppy drive itself.
Then, on the end that you normaly connect to your motherboard, find pin 1 (see the red wire)

Connect pin 13 & 14 together.
Connect pins 17 & 19 to ground.
Connect pin 18 to digital 3 on the arduino
Connect pin 20 to digital 2 on the arduino

Basic Code

NO MARIO TUNE YET

 const byte FIRST_PIN = 2;
 const byte PIN_MAX = 3;
 
 void setup()
 {
   pinMode(13, OUTPUT);
   pinMode(2, OUTPUT);
   pinMode(3, OUTPUT);
   pinMode(13, HIGH);
 }
 
 void loop()
 {
   reset();
   for (byte s=0;s<180;s++){ // For max drive's position
     for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
       digitalWrite(p,HIGH);
       digitalWrite(p,LOW);
     }
     delay(2);
   }
 }
 
 void reset()
 {
   for (byte s=0;s<80;s++){ // For max drive's position
     for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
       digitalWrite(p+1,HIGH); // Go in reverse
       digitalWrite(p,HIGH);
       digitalWrite(p,LOW);
       digitalWrite(p+1,LOW);
     }
     delay(5);
   }
 }