Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Programming Questions / Re: MIDI doesnt work when I add buttons on: June 22, 2014, 06:14:09 am
I tried your mod but it didn't seem to work. Maybe I'll make a video later showing the problem Im having. Essentially I just wanted to use this code that I found online and expand it to include more than one button, I didnt figure it would be so difficult! ha

Code:
#include <MIDI.h>
 
#define KEY 8
#define LED 13
 
int keyispressed = 0; //Variable. Is the key currently pressed?
int noteisplaying = 0; //Variable. Is the Note currently playing?
 
void  setup() //The Setup Loop
{
  pinMode(LED, OUTPUT);  //Set pin 13 , the led, to output
  pinMode(KEY, INPUT);  //Set pin 8 to input to detect the key press
  MIDI.begin(); //initialise midi library
}
//---------------------------------------------
void loop() //the main loop
{
  keyispressed = digitalRead(KEY); //read pin 8
 
  if (keyispressed == HIGH){ //the key on the board is pressed
    digitalWrite(LED, HIGH); //set the LED to on.
    if(!noteisplaying){ //if the note is not already playing send MIDI instruction to start
       MIDI.sendNoteOn(36,127,1);  // Send a Note (pitch 36 (C2), vel.127  ch. 1)
       noteisplaying = 1; // set the note playing flag to TRUE
    }
  }
  else{
    digitalWrite(LED,LOW); // the key is not pressed. Turn off the LED
    if(noteisplaying){ //if the note is currently playing, turn it off
      MIDI.sendNoteOff(36,0,1);   // Stop the note
      noteisplaying = 0; // clear the note is playing flag
    }
  }
}
2  Using Arduino / Programming Questions / Re: MIDI doesnt work when I add buttons on: June 21, 2014, 09:48:23 pm
It doesnt seem to matter if I add additional noteisplaying variables, the result is still all messed up. Could you elaborate on the repeated note on messages? Im not sure how to make those edits. 
3  Using Arduino / Programming Questions / MIDI doesnt work when I add buttons on: June 20, 2014, 10:13:17 pm
This code triggers a midi note when a button is pressed.
Code:
#include <MIDI.h>

const int buttonPin = 13;
int buttonstate = 0; //Variable. Is the key currently pressed?
int noteisplaying = 0; //Variable. Is the Note currently playing?


void  setup() //The Setup Loop
{

  pinMode(buttonPin, INPUT);  //Set pin 13 to input to detect the key pre

  MIDI.begin(); //initialise midi library
}
//---------------------------------------------
void loop() //the main loop
{
  buttonstate = digitalRead(buttonPin); //read pin 13
  if (buttonstate == HIGH) { //the key on the board is pressed
    MIDI.sendNoteOn(36, 127, 1); // Send a Note (pitch 36 (C2), vel.127  ch. 1)
    noteisplaying = 1; // set the note playing flag to TRUE

  }
  else {

    if (noteisplaying) { //if the note is currently playing, turn it off
      MIDI.sendNoteOff(36, 0, 1); // Stop the note
      noteisplaying = 0; // clear the note is playing flag
    }
  }


}

It works great but I need to expand the number of buttons for my synthesizer project and whenever I try to add buttons the resulting MIDI notes sounds all messed up or just dont play at all. Heres the modified code I tried:

Code:
#include <MIDI.h>

const int buttonPin = 13;
const int buttonPin1 = 12;
int buttonstate = 0; //Variable. Is the key currently pressed?
int buttonstate1 = 0;
int noteisplaying = 0; //Variable. Is the Note currently playing?


void  setup() //The Setup Loop
{

  pinMode(buttonPin, INPUT);  //Set pin 13 to input to detect the key press
  pinMode(buttonPin1, INPUT); //Set pin 12 to input to detect the key press

  MIDI.begin(); //initialise midi library
}
//---------------------------------------------
void loop() //the main loop
{
  buttonstate = digitalRead(buttonPin); //read pin 13
  buttonstate1 = digitalRead(buttonPin1); //Read pin 12
  if (buttonstate == HIGH) { //the key on the board is pressed
    MIDI.sendNoteOn(36, 127, 1); // Send a Note (pitch 36 (C2), vel.127  ch. 1)
    noteisplaying = 1; // set the note playing flag to TRUE

  }
  else {

    if (noteisplaying) { //if the note is currently playing, turn it off
      MIDI.sendNoteOff(36, 0, 1); // Stop the note
      noteisplaying = 0; // clear the note is playing flag
    }
  }

  if (buttonstate1 == HIGH) { //the key on the board is pressed
    MIDI.sendNoteOn(37, 127, 1); // Send a Note (pitch 36 (C2), vel.127  ch. 1)
    noteisplaying = 1; // set the note playing flag to TRUE

  }
  else {

    if (noteisplaying) { //if the note is currently playing, turn it off
      MIDI.sendNoteOff(37, 0, 1); // Stop the note
      noteisplaying = 0; // clear the note is playing flag
    }
  }


}
4  Using Arduino / Programming Questions / Can't get simple MIDI example to work on: June 12, 2014, 11:35:12 am
Im trying to build a simple pushbutton synthesizer but thought I would start out by first trying the MIDI example built into the Arduino IDE. Here is the code:

Code:
*/

void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

I can't get the code to work properly. I have a midi jack connected to the arduino which is connected to a MIDI to USB converter. I plan on using Garageband to control the instrument samples. I know some sort of connection is being established because if I rest the Arduino, Garageband flashes its position indicator. When I open the serial monitor I get a whole bunch of jibberish despite the baud rate being set correctly within the program. Here is an example of what its outputting:

Quote
êNEêNêOEêOêPEêPêQEêQêREêRêSEêSêTEêTêUEêUêVEêVêWEêWêXEêXêYEêYêEêêEêê Eê ê!Eê!ê"Eê"ê#Eê#ê$Eê$ê%Eê%ê&Eê&ê'Eê'ê(Eê(ê

I'm using a Leonardo and I've checked all the connections... any ideas?
5  Using Arduino / Programming Questions / Re: 4 probes + 6 contact pads = 24 possible serial outputs. on: June 04, 2014, 05:14:56 pm
What part of the code would I change to indicate that the array type has changed? Im still learning.
6  Using Arduino / Programming Questions / Re: 4 probes + 6 contact pads = 24 possible serial outputs. on: June 03, 2014, 08:52:04 pm
Ok I've edited the code with " " to indicate multiple characters but the code doesnt compile.  Heres the code and the error I'm getting.

Code:

#include <Keypad.h>

const byte ROWS = 10; //ten rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
  {"1", "2", "3", "4"},
  {"5", "6", "7", "8"},
  {"9", "10", "11", "12"},
  {"13", "14", "15", "16"},
  {"17", "18", "19", "20"},
  {"21", "22", "23", "24"},
  {"25", "26", "27", "28"},
  {"29", "30", "31", "32"},
  {"33", "34", "35", "36"},
  {"37", "38", "39", "40"}
};
byte rowPins[ROWS] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {0, 1, 2, 3}; //connect to the column pinouts of the kpd

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

unsigned long loopCount;
unsigned long startTime;
String msg;


void setup() {
  Serial.begin(9600);
  loopCount = 0;
  startTime = millis();
  msg = "";
}


void loop() {
  loopCount++;
  if ( (millis() - startTime) > 5000 ) {
    Serial.print("Average loops per second = ");
    Serial.println(loopCount / 5);
    startTime = millis();
    loopCount = 0;
  }

  // Fills kpd.key[ ] array with up-to 10 active keys.
  // Returns true if there are ANY active keys.
  if (kpd.getKeys())
  {
    for (int i = 0; i < LIST_MAX; i++) // Scan the whole key list.
    {
      if ( kpd.key[i].stateChanged )   // Only find keys that have changed state.
      {
        switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
          case PRESSED:
            msg = " PRESSED.";
            break;
          case HOLD:
            msg = " HOLD.";
            break;
          case RELEASED:
            msg = " RELEASED.";
            break;
          case IDLE:
            msg = " IDLE.";
        }
        Serial.print("Key ");
        Serial.print(kpd.key[i].kchar);
        Serial.println(msg);
      }
    }
  }
}  // End loop


Error:
Quote
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'
MultiKey:29: error: too many initializers for 'char [4]'

I've noticed that if I use an * after char it complies but when run the code on the arduino the serial monitor outputs a lot of nonsensical figures when the buttons are pushed.
7  Using Arduino / Programming Questions / Re: 4 probes + 6 contact pads = 24 possible serial outputs. on: June 03, 2014, 07:15:44 pm
Sorry I dont understand what you mean about the quotes?
8  Using Arduino / Programming Questions / Re: 4 probes + 6 contact pads = 24 possible serial outputs. on: May 29, 2014, 11:31:10 pm
While tinkering around I've noticed I can expand the array of possible buttons but after "9" the serial monitor only displays the second digit of the two digit number. For instance, button 23, when pressed would only show up as a 3 in the serial monitor. Any idea why that might be? Heres the code:

Code:
#include <Keypad.h>

const byte ROWS = 10; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
{'1','2','3','4'},
{'5','6','7','8'},
{'9','10','11','12'},
{'13','14','15','16'},
{'17','18','19','20'},
{'21','22','23','24'},
{'25','26','27','28'},
{'29','30','31','32'},
{'33','34','35','36'},
{'37','38','39','40'}
};
byte rowPins[ROWS] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {0, 1, 2, 3}; //connect to the column pinouts of the kpd

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

unsigned long loopCount;
unsigned long startTime;
String msg;


void setup() {
    Serial.begin(9600);
    loopCount = 0;
    startTime = millis();
    msg = "";
}


void loop() {
    loopCount++;
    if ( (millis()-startTime)>5000 ) {
        Serial.print("Average loops per second = ");
        Serial.println(loopCount/5);
        startTime = millis();
        loopCount = 0;
    }

    // Fills kpd.key[ ] array with up-to 10 active keys.
    // Returns true if there are ANY active keys.
    if (kpd.getKeys())
    {
        for (int i=0; i<LIST_MAX; i++)   // Scan the whole key list.
        {
            if ( kpd.key[i].stateChanged )   // Only find keys that have changed state.
            {
                switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
                    case PRESSED:
                    msg = " PRESSED.";
                break;
                    case HOLD:
                    msg = " HOLD.";
                break;
                    case RELEASED:
                    msg = " RELEASED.";
                break;
                    case IDLE:
                    msg = " IDLE.";
                }
                Serial.print("Key ");
                Serial.print(kpd.key[i].kchar);
                Serial.println(msg);
            }
        }
    }
}  // End loop
9  Using Arduino / Programming Questions / Re: 4 probes + 6 contact pads = 24 possible serial outputs. on: May 26, 2014, 11:06:54 pm
Wow, that was surprisingly simple. Thanks guys!
10  Using Arduino / Programming Questions / 4 probes + 6 contact pads = 24 possible serial outputs. on: May 26, 2014, 08:45:26 pm
Hello,

I want to build a simple project for an art installation in which one of four probes makes contact with one of six contact pads or "metal plates" and outputs different text into the serial monitor for each. I will be using an Arduino Leonardo for this project and and hoping to accomplish this only using the digital pins if possible (I need the analog pins for another part of the project). My knowledge of programming is extremely limited but I know the basics. Does anyone know of a similar project online that I could modify to achieve what Im looking to do?

11  Using Arduino / Programming Questions / Re: MPR121 Capacitive Touch Sensor Synth on: May 23, 2014, 06:53:35 pm
Heres the modified code:

Code:
#include "mpr121.h"
#include <Wire.h>
#include "pitches.h"
#define speaker 11

int irqpin = 2; // Digital 2
boolean touchStates[12]; //to keep track of the previous touch states

void setup(){
 pinMode(irqpin, INPUT);
 digitalWrite(irqpin, HIGH); //enable pullup resistor
 
 Serial.begin(9600);
 Wire.begin();

 mpr121_setup();
}

void loop(){
 readTouchInputs();
}


void readTouchInputs(){
 if(!checkInterrupt()){
 
  //read the touch state from the MPR121
  Wire.requestFrom(0x5A,2);
 
  byte LSB = Wire.read();
  byte MSB = Wire.read();
 
  uint16_t touched = ((MSB << 8) | LSB); //16bits that make up the touch states

 
  for (int i=0; i < 12; i++){ // Check what electrodes were pressed
   if(touched & (1<<i)){
   
    if(touchStates[i] == 0){
  //pin i was just touched
  Serial.print("pin ");
  Serial.print(i);
  Serial.println(" was just touched");


  switch (i) {
    case 0:
      //0 was touched

      break;
    case 1:
      //1 was touched

      break;
    case 2:
      //2 was touched

      break;
    case 3:
      //3 was touched
  }

}
   
    }else if(touchStates[i] == 1){
     //pin i is still being touched
    }
   
    touchStates[i] = 1;   
   }else{
    if(touchStates[i] == 1){
     Serial.print("pin ");
     Serial.print(i);
     Serial.println(" is no longer being touched");
     
     //pin i is no longer being touched
   }
   
    touchStates[i] = 0;
   }
 
  }
 
 }
}




void mpr121_setup(void){

 set_register(0x5A, ELE_CFG, 0x00);
 
 // Section A - Controls filtering when data is > baseline.
 set_register(0x5A, MHD_R, 0x01);
 set_register(0x5A, NHD_R, 0x01);
 set_register(0x5A, NCL_R, 0x00);
 set_register(0x5A, FDL_R, 0x00);

 // Section B - Controls filtering when data is < baseline.
 set_register(0x5A, MHD_F, 0x01);
 set_register(0x5A, NHD_F, 0x01);
 set_register(0x5A, NCL_F, 0xFF);
 set_register(0x5A, FDL_F, 0x02);
 
 // Section C - Sets touch and release thresholds for each electrode
 set_register(0x5A, ELE0_T, TOU_THRESH);
 set_register(0x5A, ELE0_R, REL_THRESH);

 set_register(0x5A, ELE1_T, TOU_THRESH);
 set_register(0x5A, ELE1_R, REL_THRESH);
 
 set_register(0x5A, ELE2_T, TOU_THRESH);
 set_register(0x5A, ELE2_R, REL_THRESH);
 
 set_register(0x5A, ELE3_T, TOU_THRESH);
 set_register(0x5A, ELE3_R, REL_THRESH);
 
 set_register(0x5A, ELE4_T, TOU_THRESH);
 set_register(0x5A, ELE4_R, REL_THRESH);
 
 set_register(0x5A, ELE5_T, TOU_THRESH);
 set_register(0x5A, ELE5_R, REL_THRESH);
 
 set_register(0x5A, ELE6_T, TOU_THRESH);
 set_register(0x5A, ELE6_R, REL_THRESH);
 
 set_register(0x5A, ELE7_T, TOU_THRESH);
 set_register(0x5A, ELE7_R, REL_THRESH);
 
 set_register(0x5A, ELE8_T, TOU_THRESH);
 set_register(0x5A, ELE8_R, REL_THRESH);
 
 set_register(0x5A, ELE9_T, TOU_THRESH);
 set_register(0x5A, ELE9_R, REL_THRESH);
 
 set_register(0x5A, ELE10_T, TOU_THRESH);
 set_register(0x5A, ELE10_R, REL_THRESH);
 
 set_register(0x5A, ELE11_T, TOU_THRESH);
 set_register(0x5A, ELE11_R, REL_THRESH);
 
 // Section D
 // Set the Filter Configuration
 // Set ESI2
 set_register(0x5A, FIL_CFG, 0x04);
 
 // Section E
 // Electrode Configuration
 // Set ELE_CFG to 0x00 to return to standby mode
 set_register(0x5A, ELE_CFG, 0x0C); // Enables all 12 Electrodes
 
 
 // Section F
 // Enable Auto Config and auto Reconfig
 /*set_register(0x5A, ATO_CFG0, 0x0B);
 set_register(0x5A, ATO_CFGU, 0xC9); // USL = (Vdd-0.7)/vdd*256 = 0xC9 @3.3V  set_register(0x5A, ATO_CFGL, 0x82); // LSL = 0.65*USL = 0x82 @3.3V
 set_register(0x5A, ATO_CFGT, 0xB5);*/ // Target = 0.9*USL = 0xB5 @3.3V
 
 set_register(0x5A, ELE_CFG, 0x0C);
 
}


boolean checkInterrupt(void){
 return digitalRead(irqpin);
}


void set_register(int address, unsigned char r, unsigned char v){
  Wire.beginTransmission(address);
  Wire.write(r);
  Wire.write(v);
  Wire.endTransmission();
}




And here are the error messages I'm getting:

Quote
Arduino: nightly (Mac OS X), Board: "Arduino Leonardo"

Capacitive_Touch.ino: In function 'void readTouchInputs()':
Capacitive_Touch:61: error: expected primary-expression before '}' token
Capacitive_Touch:61: error: expected `;' before '}' token
Capacitive_Touch:70: error: expected `}' before 'else'
Capacitive_Touch:71: error: 'i' was not declared in this scope
Capacitive_Touch:79: error: 'i' was not declared in this scope
Capacitive_Touch.ino: At global scope:
Capacitive_Touch:84: error: expected declaration before '}' token

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
12  Using Arduino / Programming Questions / MPR121 Capacitive Touch Sensor Synth on: May 23, 2014, 06:21:30 pm
I want to build a very simple synth using the MPR121 capacitive touch sensor breakout and the tone values stored in 'pitches.h'.

I followed the tutorial here (http://bildr.org/2011/05/mpr121_arduino/) to get the capacitance sensors working and they work fine using this code

Code:
#include "mpr121.h"
#include <Wire.h>

int irqpin = 2; // Digital 2
boolean touchStates[12]; //to keep track of the previous touch states

void setup(){
 pinMode(irqpin, INPUT);
 digitalWrite(irqpin, HIGH); //enable pullup resistor
 
 Serial.begin(9600);
 Wire.begin();

 mpr121_setup();
}

void loop(){
 readTouchInputs();
}


void readTouchInputs(){
 if(!checkInterrupt()){
 
  //read the touch state from the MPR121
  Wire.requestFrom(0x5A,2);
 
  byte LSB = Wire.read();
  byte MSB = Wire.read();
 
  uint16_t touched = ((MSB << 8) | LSB); //16bits that make up the touch states

 
  for (int i=0; i < 12; i++){ // Check what electrodes were pressed
   if(touched & (1<<i)){
   
    if(touchStates[i] == 0){
     //pin i was just touched
     Serial.print("pin ");
     Serial.print(i);
     Serial.println(" was just touched");
   
    }else if(touchStates[i] == 1){
     //pin i is still being touched
    }
   
    touchStates[i] = 1;   
   }else{
    if(touchStates[i] == 1){
     Serial.print("pin ");
     Serial.print(i);
     Serial.println(" is no longer being touched");
     
     //pin i is no longer being touched
   }
   
    touchStates[i] = 0;
   }
 
  }
 
 }
}




void mpr121_setup(void){

 set_register(0x5A, ELE_CFG, 0x00);
 
 // Section A - Controls filtering when data is > baseline.
 set_register(0x5A, MHD_R, 0x01);
 set_register(0x5A, NHD_R, 0x01);
 set_register(0x5A, NCL_R, 0x00);
 set_register(0x5A, FDL_R, 0x00);

 // Section B - Controls filtering when data is < baseline.
 set_register(0x5A, MHD_F, 0x01);
 set_register(0x5A, NHD_F, 0x01);
 set_register(0x5A, NCL_F, 0xFF);
 set_register(0x5A, FDL_F, 0x02);
 
 // Section C - Sets touch and release thresholds for each electrode
 set_register(0x5A, ELE0_T, TOU_THRESH);
 set_register(0x5A, ELE0_R, REL_THRESH);

 set_register(0x5A, ELE1_T, TOU_THRESH);
 set_register(0x5A, ELE1_R, REL_THRESH);
 
 set_register(0x5A, ELE2_T, TOU_THRESH);
 set_register(0x5A, ELE2_R, REL_THRESH);
 
 set_register(0x5A, ELE3_T, TOU_THRESH);
 set_register(0x5A, ELE3_R, REL_THRESH);
 
 set_register(0x5A, ELE4_T, TOU_THRESH);
 set_register(0x5A, ELE4_R, REL_THRESH);
 
 set_register(0x5A, ELE5_T, TOU_THRESH);
 set_register(0x5A, ELE5_R, REL_THRESH);
 
 set_register(0x5A, ELE6_T, TOU_THRESH);
 set_register(0x5A, ELE6_R, REL_THRESH);
 
 set_register(0x5A, ELE7_T, TOU_THRESH);
 set_register(0x5A, ELE7_R, REL_THRESH);
 
 set_register(0x5A, ELE8_T, TOU_THRESH);
 set_register(0x5A, ELE8_R, REL_THRESH);
 
 set_register(0x5A, ELE9_T, TOU_THRESH);
 set_register(0x5A, ELE9_R, REL_THRESH);
 
 set_register(0x5A, ELE10_T, TOU_THRESH);
 set_register(0x5A, ELE10_R, REL_THRESH);
 
 set_register(0x5A, ELE11_T, TOU_THRESH);
 set_register(0x5A, ELE11_R, REL_THRESH);
 
 // Section D
 // Set the Filter Configuration
 // Set ESI2
 set_register(0x5A, FIL_CFG, 0x04);
 
 // Section E
 // Electrode Configuration
 // Set ELE_CFG to 0x00 to return to standby mode
 set_register(0x5A, ELE_CFG, 0x0C); // Enables all 12 Electrodes
 
 
 // Section F
 // Enable Auto Config and auto Reconfig
 /*set_register(0x5A, ATO_CFG0, 0x0B);
 set_register(0x5A, ATO_CFGU, 0xC9); // USL = (Vdd-0.7)/vdd*256 = 0xC9 @3.3V  set_register(0x5A, ATO_CFGL, 0x82); // LSL = 0.65*USL = 0x82 @3.3V
 set_register(0x5A, ATO_CFGT, 0xB5);*/ // Target = 0.9*USL = 0xB5 @3.3V
 
 set_register(0x5A, ELE_CFG, 0x0C);
 
}


boolean checkInterrupt(void){
 return digitalRead(irqpin);
}


void set_register(int address, unsigned char r, unsigned char v){
  Wire.beginTransmission(address);
  Wire.write(r);
  Wire.write(v);
  Wire.endTransmission();
}



The problem is, the tutorial says that you can use the sensors to trigger specific events (like sound) with the following addition to the code and I cant get it to compile...

Code:
if(touchStates[i] == 0){
  //pin i was just touched
  Serial.print("pin ");
  Serial.print(i);
  Serial.println(" was just touched");


  switch (i) {
    case 0:
      //0 was touched

      break;
    case 1:
      //1 was touched

      break;
    case 2:
      //2 was touched

      break;
    case 3:
      //3 was touched
  }

}


I really like the code that was written for the sensors because they can read multiple sensors at on time so I would be able to play chords.
13  Using Arduino / Sensors / Re: Optical Guitar Pickup on: April 15, 2014, 10:48:13 am
Im to understand that using a modulated IR light source and a receiver set to filter all but the modulated frequencies should take care of the ambient light... or would this not be sufficient? I cant use a magnetic pickup because I need an analog output from each individual string. There are a couple DIY solutions online to making small magnetic pickups for each individual string but thats a lot of wire winding  smiley-roll-sweat

I was wondering if a circuit like this would work:


It uses an IC LM567 Tone Decoder. The circuit I suggested before uses an IC LM339N Comparator. I guess Im not sure what the difference between a tone decoder and a comparator is... it seems in this instance they are serving the same function.

 As for the weak signal response I would assume I could run the output through a signal amplifier?

Thanks for being patient, Im learning!  smiley


14  Using Arduino / Sensors / Re: Optical Guitar Pickup on: April 14, 2014, 10:26:53 pm
I just need an indication that the string is vibrating. No audio. So will this type of modulated IR reflection sensor be the right sensor for the job?
15  Using Arduino / Sensors / Optical Guitar Pickup on: April 14, 2014, 10:22:57 am
I want to build a simple optical pickup to detect the vibration of a guitar string. I was hoping to achieve this with a reflective IR sensor to minimize the pickups aesthetic footprint. I would like to eventually take the analog signal generated and input it into arduino to see if I can use string vibrations to trigger other events.

1) Would it be best to use a modulated IR signal (38KHz) and corresponding IR receiver?

if so...

2) Would a 4 channel IR breakout such as this one be modulated to 38KHz? I've looked at a few different variants of this breakout on different sites and I cant seem to find an answer.
Pages: [1] 2 3 4