Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Synthemafia
Published © TAPR-OHL

Modular synth 8 step sequencer, DIY ARDUINO, "SM PURPLE 8"

Complete tutorial to build your own 8 step sequencer using an Arduino.

BeginnerFull instructions provided14,508
Modular synth 8 step sequencer, DIY ARDUINO, "SM PURPLE 8"

Things used in this project

Story

Read more

Schematics

"SM PURPLE 8" circuit diagram

Code

"SM PURPLE 8" arduino code

Arduino
/*****************Programmed by SyntheMafia(01_07_2018)**********************/

void setup() {
  
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, INPUT);
  pinMode(11, INPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  pinMode(14, OUTPUT);
  pinMode(15, OUTPUT);
  pinMode(16, OUTPUT);
  pinMode(17, OUTPUT);
  pinMode(18, OUTPUT);
  pinMode(19, OUTPUT);
  
 
}


bool started = false;
int cont = 0;
/***************************************************************************/

void loop() {

    if (!started) {
      int cont = 0;
      started = true;
    }

   int wait = 0;
   int backwards;
   int four;
 
   
   if (cont == 0)  {
    
      digitalWrite(2, HIGH);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, HIGH);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }  

      backwards = analogRead(21);
      four = analogRead(20);
      

      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 1;
      }      
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 1;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 7;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 3;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
      
}
      
/***************************************************************************/
  if (cont == 1)  {
    
      digitalWrite(2, LOW);
      digitalWrite(3, HIGH);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, HIGH);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }  

      
      backwards = analogRead(21);
      four = analogRead(20);
      
      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 2;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 2;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 0;
      }
      if (backwards > 100 && four > 100 && digitalRead(11) == LOW){
        cont = 0;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
  }
      
/***************************************************************************/
   if (cont == 2)  {
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, HIGH);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, HIGH);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }  

      backwards = analogRead(21);
      four = analogRead(20);
      
      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 1;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 1;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
 }
      
/***************************************************************************/
   if (cont == 3)  {   
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, HIGH);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, HIGH);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
     
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }  

      backwards = analogRead(21);
      four = analogRead(20);

      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 4;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 0;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 2;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 2;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
   }
      
/***************************************************************************/
    if (cont == 4)  {  
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, HIGH);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, HIGH);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
     
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      } 

      backwards = analogRead(21);
      four = analogRead(20);

      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 5;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 3;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
    }

/***************************************************************************/

    if (cont == 5)  {  
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, HIGH);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, HIGH);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }  

      backwards = analogRead(21);
      four = analogRead(20);

      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 6;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 4;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 3;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
    }

/***************************************************************************/

    if (cont == 6)  {  
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, HIGH);
      digitalWrite(9, LOW); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, HIGH);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }  

      backwards = analogRead(21);
      four = analogRead(20);

      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 7;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 5;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 3;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
    }
      
/***************************************************************************/

    if (cont == 7) {  
      
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, HIGH); 
      
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, HIGH);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      }
      while (digitalRead(10) == HIGH && digitalRead(11) == LOW){
        wait = 0;
      }
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);
      digitalWrite(14, LOW);
      digitalWrite(15, LOW);
      digitalWrite(16, LOW);
      digitalWrite(17, LOW);
      digitalWrite(18, LOW);
      digitalWrite(19, LOW);
      
      while (digitalRead(10) == LOW && digitalRead(11) == LOW){
        wait = 0;
      } 

      backwards = analogRead(21);
      four = analogRead(20);

      if (backwards < 100 && four < 100 && digitalRead(11) == LOW){
        cont = 0;
      }
      if (backwards < 100  && four > 100 && digitalRead(11) == LOW){
        cont = 3;
      }
      if (backwards > 100 && four < 100 && digitalRead(11) == LOW){
        cont = 6;
      }
      if (backwards > 100 && four > 100  && digitalRead(11) == LOW){
        cont = 3;
      }
      if (digitalRead(11) == HIGH){
      cont = 0;
        while (digitalRead(11) == HIGH){
        wait = 0;
      }
      }
    }
}

Credits

Synthemafia
2 projects • 40 followers

Comments