Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
MrvStrett
Published © GPL3+

Strettocaster - GuitArduino Project

Live bespoke effects manipulation from a Guitar Body using Arduino/Max4Live

IntermediateShowcase (no instructions)1,387
Strettocaster - GuitArduino Project

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Arduino Set-Up

Code

Arduino Code for Inputs.ino

Arduino
Code for the Set-Up i used
//constants
const int buttonPin2 = 2;     //push button (Red)
const int numVal2 =-4080;        //Number to be sent
//------------------------------
const int buttonPin3 = 3;     //push button (Green)
const int numVal3 =-5080;        //Number to be sent
//------------------------------
const int buttonPin4 = 4;     //push button (Yellow)
const int numVal4 =-6080;        //Number to be sent

//variables

//------Button1----------------
int buttonState2 = 0;         //current state of the button
int lastButtonState2= 0;      //previous button state
//------Button2----------------
int buttonState3 = 0;         //current state of the button
int lastButtonState3= 0;      //previous button state
//------Button3----------------
int buttonState4 = 0;         //current state of the button
int lastButtonState4= 0;      //previous button state

//---- TouchStrip---------------
int softpotPin = A5;

//---- Touchscreen--------------
int y1 = A0;
int x2 = A1;
int y2 = A2;
int x1 = A3;

void setup() {

//----------Buttons----------------------------

  //initiallise the button on pin2 
  pinMode(buttonPin2, INPUT);
  //initialise the serial communication
  Serial.begin(9600);

    //initiallise the button on pin3
    pinMode(buttonPin3, INPUT);
    //initialise the serial communication
    Serial.begin(9600);

       //initiallise the button on pin4
       pinMode(buttonPin4, INPUT);
       //initialise the serial communication
       Serial.begin(9600);

    //---------------Touchstrip----------------------------

       Serial.begin(9600);
       pinMode(softpotPin, INPUT);
       delay(200);

       int softpotReading = analogRead(softpotPin); 
       Serial.println(softpotReading);

      //-------------Touchscreen---------------------------

       Serial.begin(9600);
       } 

          int readX(){
            pinMode(y1, INPUT);
            pinMode(x2, OUTPUT);
            pinMode(y2, INPUT);
            pinMode(x1, OUTPUT);
          
            digitalWrite(x2, LOW);
            digitalWrite(x1, HIGH);
          
            delay(5); //pause to allow lines to power up
          
            return analogRead(y1);
          }
          
          int readY(){
          
            pinMode(y1, OUTPUT);
            pinMode(x2, INPUT);
            pinMode(y2, OUTPUT);
            pinMode(x1, INPUT);
          
            digitalWrite(y1, LOW);
            digitalWrite(y2, HIGH);
          
            delay(5); //pause to allow lines to power up
          
            return analogRead(x2);
          
} //end setup

      void loop() {

//---------Buttons--------------------------
    
      //read button state
      buttonState2 = digitalRead(buttonPin2);
    
      //compare the button state against previous
      if (buttonState2 != lastButtonState2) {
    
        //if the state has changed, nothing
        if(buttonState2 == HIGH) {
    
        }else{
          //if current state is low, send value 
          Serial.println(numVal2);
        }
          //incase of bounce
          delay(5);
        }
    
        //save current state as the last, for the next press
        lastButtonState2 = buttonState2;
      
          //read button state
          buttonState3 = digitalRead(buttonPin3);
      
          //compare the button state against previous
          if (buttonState3 != lastButtonState3) {
      
          //if the state has changed, nothing
          if(buttonState3 == HIGH) {
      
          }else{
            //if current state is low, send value 
            Serial.println(numVal3);
          }
            //incase of bounce
            delay(5);
          }
      
          //save current state as the last, for the next press
          lastButtonState3 = buttonState3;

                //read button state
                buttonState4 = digitalRead(buttonPin4);
      
                //compare the button state against previous
                if (buttonState4 != lastButtonState4) {
      
                //if the state has changed, nothing
                if(buttonState4 == LOW) {
      
                }else{
                //if current state is low, send value 
                Serial.println(numVal4);
                }
                //incase of bounce
                delay(5);
                }
      
      //save current state as the last, for the next press
        lastButtonState4 = buttonState4;


//------------Touchstrip------------------------------

          int softpotReading = analogRead(softpotPin);

          //if the state is 1000 or below, nothing
          if(softpotReading < 99){
            
    
          }else{
          Serial.println(softpotReading*10);

          }

         delay(50); //Slows things down, easier to read 

         {

//-------------------Touchscreen----------------------

  int x = readX();
  int y = readY();

  if(x < 1000 & y < 1000){
    Serial.print("x: ");
    Serial.print(x);
    Serial.print(" - y: ");
    Serial.println(y);  
  }

delay(40); //just to slow things down, easier to read
  
 }      
}

Credits

MrvStrett
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.