Pages: [1] 2   Go Down
Author Topic: Can I pay someone to write a sketch for me?  (Read 2397 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having a hell of a time with this, and I'm not a programmer.  I bought a duemilanove thinking there was enough documentation to do what I want to do so I could easily learn, but i'm seeing this is not the case.  

I'm in a band and I just need to get something built and working well.  I don't want to spend a long time learning programming just to get this to work.  

My needs are simple I think:

1) receive midi signals
2) make those midi signals light specific LEDs depending on their information.

I will use a max2771 for the led matrix.

I want to go midi input via USB ideally.

The midi note information will control which LED is being affected.  The velocity information will determine the state of the LED (on, off, or blinking).

That's it.  There are 32 independant LEDs.  If someone could get me up and running on two leds, I can figure out the rest.  

Please email me at joel@rattletree.com and tell me if you can do this, and how long it'd take and what you'd charge me.
Thanks!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Clueless newbie
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Take a look here, might get you started:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1187962258

http://tomscarff.110mb.com/midi_analyser/midi_analyser.htm

http://www.arduino.cc/playground/Main/InterfacingWithHardware#Communication   (scroll down to MIDI section)
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's definately not very complicated to make.

In addition to our MIDI IN tread, I can suggest you to have a look at this library http://www.arduino.cc/playground/Main/LedControl and the matrix example.
You only need conditions and some  "lc.setLed(0,row,col,true);" to light up the leds.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@tep Cool.  I had seen the schematic aspect of the MAX7221 section, but had not found the library part.  Thank you!

@LiMiT  I've checked out those links.  My question is: I see folks are building the MIDI in through a standard midi 5-pin connector...can the same thing be done via the USB cable?  I need to power all the LEDs in the enclosure, so one USB cable would be better than an external power supply and a MIDI cable.  If that greatly complicates the project or makes it less stable somehow though, I can go with the two wire route...

So my basic understanding is I will kludge the midi input with the library for the LED matrix output...
but that's where I need the help because I don't know how to gule them together!
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For MIDI over USB, two solutions :
- A software that does the translation http://www.spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html
- A USB-MIDI cable hidden inside the enclosure

Here you can see how a put on or off the onboard LED for middle C: (untested, should work)
Code:
//variables setup
byte incomingByte;

int statusLed = 13;   // select the pin for the LED


//setup: declaring iputs and outputs and begin serial
void setup() {
  pinMode(statusLed,OUTPUT);   // declare the LED's pin as output
  Serial.begin(31250);        //start serial with midi baudrate 31250 or 38400 for debugging
}


void loop () {
  
 if (Serial.available() > 0) {
    incomingByte = Serial.read();
    if (incomingByte==144){ // 144 is note on ch1
      incomingByte = Serial.read();
      if (incomingByte==60){ // 60 is middle C
        incomingByte = Serial.read();
        if(incomingByte>0){  //velocity >0
          digitalWrite(statusLed, HIGH);
        }else{ //velocity=0
          digitalWrite(statusLed, LOW);
        }
      }
    }
 }
 
}

 

You just have to make a working LED matrix and add the code instead of my digitalWrites.  smiley
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent...That software translator looks perfect...I'm downloading it now.  I have built the matrix and hooked up the schematic for the max7221 (Actually, I have set up one column of LED's to test).

So specifically what I need the code to do is this:

Here is the midi note information sent from Ableton (this would be for each individual LED):

a) clip has been triggered but is not yet playing:
message type: NOTE ON
velocity: 126 (LED is BLINKING)

b) clip is playing:
message type: NOTE ON
velocity: 127 (LED is ON)

c) clip is looping:
message type: NOTE ON
velocity: 1 (LED is ON)

d) clip has been stopped:
message type: NOTE OFF
velocity: 0 (LED is OFF)

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All right-I have had some success!  I got that software midi input working.  I am now able to receive those MIDI feedback notes from Ableton into Arduino!  Now I just have to figure out how to tell Arduino what to do with that information!
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK-I'm having some fun now.   smiley-grin  I imported the library for the matrix and got that working for me as well!  Yea!  

Now I just have to figure out the glue that brings these two worlds together!
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good, you see, never give up !  smiley-grin
Simplify the matrix code to just manual light on some led, it will be very clear later.
For the moment don't look after the blinking leds, just on and off and will look at that later  smiley-wink

Thanks for your informations about midi note control in ableton live! I didn't yet looked after that, but the possibilities are great!
« Last Edit: August 31, 2009, 02:11:03 am by tep » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your help in getting me on the right track!  I can almost taste success. smiley-grin

Quote
Simplify the matrix code to just manual light on some led, it will be very clear later.

I'm not sure I understand...which code?  Do you mean the library?  The only matrix code I have is from the demo that is supplied with the library:http://www.arduino.cc/playground/Main/LedControlDemos

Quote
You just have to make a working LED matrix and add the code instead of my digitalWrites.

I don't know which part of the code I need to put in there? :-/

At this point, I have midi->serial converter, and his demo code:

Code:
//  *****************************************************************************************************************
//  *                                                                                                               *
//  *                                         SpikenzieLabs.com                                                     *
//  *                                                                                                               *
//  *                                   Very Simple Serial to MIDI DEMO                                             *
//  *                                                                                                               *
//  *****************************************************************************************************************
//
// BY: MARK DEMERS
// May 2009
// VERSION: 0.1
//
// DESCRIPTION:
// Demo sketch to play notes from middle C in the 4th octave up to B in the 5th octave and then back down.
//
//
// HOOK-UP:
// 1. Plug USB cable from Arduino into your computer.
//  
//
// USAGE:
// 1. Install and Set-up Serial MIDI Converter from SpikenzieLabs
// 2. Open, compile, and upload this sketch into your Arduino.
// 3. Run Serial MIDI Converter in the background.
// 4. Launch your music software such as Garage Band or Ableton Live, choose a software instrument and listen to the music.
//
//
// LEGAL:
// This code is provided as is. No guaranties or warranties are given in any form. It is up to you to determine
// this codes suitability for your application.
//

int note = 0;    

void setup()
{
  Serial.begin(57600);                                       // Default speed of the Serial to MIDI Converter serial port
}

void loop()
{

  for(int note=60; note<=83; note++)                        // Going Up
  {
    MIDI_TX(144,note,127);                                  // NOTE ON
    delay(100);

    MIDI_TX(128,note,127);                                  // NOTE OFF
    delay(100);
  }

  for(int note=82; note>=61; note--)                       // Coming Down
  {
    MIDI_TX(144,note,127);                                  // NOTE ON
    delay(250);

    MIDI_TX(128,note,127);                                  // NOTE OFF
    delay(250);
  }

}


void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{
  Serial.print(MESSAGE);
  Serial.print(PITCH);
  Serial.print(VELOCITY);
}

And then I have the example code for the matrix:

Code:
//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=100;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

/*
 This method will display the characters for the
 word "Arduino" one after the other on the matrix.
 (you need at least 5x7 leds to see the whole chars)
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  byte a[5]={B01111110,B10001000,B10001000,B10001000,B01111110};
  byte r[5]={B00111110,B00010000,B00100000,B00100000,B00010000};
  byte d[5]={B00011100,B00100010,B00100010,B00010010,B11111110};
  byte u[5]={B00111100,B00000010,B00000010,B00000100,B00111110};
  byte i[5]={B00000000,B00100010,B10111110,B00000010,B00000000};
  byte n[5]={B00111110,B00010000,B00100000,B00100000,B00011110};
  byte o[5]={B00011100,B00100010,B00100010,B00100010,B00011100};

  /* now display them one by one with a small delay */
  lc.setRow(0,0,a[0]);
  lc.setRow(0,1,a[1]);
  lc.setRow(0,2,a[2]);
  lc.setRow(0,3,a[3]);
  lc.setRow(0,4,a[4]);
  delay(delaytime);
  lc.setRow(0,0,r[0]);
  lc.setRow(0,1,r[1]);
  lc.setRow(0,2,r[2]);
  lc.setRow(0,3,r[3]);
  lc.setRow(0,4,r[4]);
  delay(delaytime);
  lc.setRow(0,0,d[0]);
  lc.setRow(0,1,d[1]);
  lc.setRow(0,2,d[2]);
  lc.setRow(0,3,d[3]);
  lc.setRow(0,4,d[4]);
  delay(delaytime);
  lc.setRow(0,0,u[0]);
  lc.setRow(0,1,u[1]);
  lc.setRow(0,2,u[2]);
  lc.setRow(0,3,u[3]);
  lc.setRow(0,4,u[4]);
  delay(delaytime);
  lc.setRow(0,0,i[0]);
  lc.setRow(0,1,i[1]);
  lc.setRow(0,2,i[2]);
  lc.setRow(0,3,i[3]);
  lc.setRow(0,4,i[4]);
  delay(delaytime);
  lc.setRow(0,0,n[0]);
  lc.setRow(0,1,n[1]);
  lc.setRow(0,2,n[2]);
  lc.setRow(0,3,n[3]);
  lc.setRow(0,4,n[4]);
  delay(delaytime);
  lc.setRow(0,0,o[0]);
  lc.setRow(0,1,o[1]);
  lc.setRow(0,2,o[2]);
  lc.setRow(0,3,o[3]);
  lc.setRow(0,4,o[4]);
  delay(delaytime);
  lc.setRow(0,0,0);
  lc.setRow(0,1,0);
  lc.setRow(0,2,0);
  lc.setRow(0,3,0);
  lc.setRow(0,4,0);
  delay(delaytime);
}

/*
  This function lights up a some Leds in a row.
 The pattern will be repeated on every row.
 The pattern will blink along with the row-number.
 row number 4 (index==3) will blink 4 times etc.
 */
void rows() {
  for(int row=0;row<8;row++) {
    delay(delaytime);
    lc.setRow(0,row,B10100000);
    delay(delaytime);
    lc.setRow(0,row,(byte)0);
    for(int i=0;i<row;i++) {
      delay(delaytime);
      lc.setRow(0,row,B10100000);
      delay(delaytime);
      lc.setRow(0,row,(byte)0);
    }
  }
}

/*
  This function lights up a some Leds in a column.
 The pattern will be repeated on every column.
 The pattern will blink along with the column-number.
 column number 4 (index==3) will blink 4 times etc.
 */
void columns() {
  for(int col=0;col<8;col++) {
    delay(delaytime);
    lc.setColumn(0,col,B10100000);
    delay(delaytime);
    lc.setColumn(0,col,(byte)0);
    for(int i=0;i<col;i++) {
      delay(delaytime);
      lc.setColumn(0,col,B10100000);
      delay(delaytime);
      lc.setColumn(0,col,(byte)0);
    }
  }
}

/*
 This function will light up every Led on the matrix.
 The led will blink along with the row-number.
 row number 4 (index==3) will blink 4 times etc.
 */
void single() {
  for(int row=0;row<8;row++) {
    for(int col=0;col<8;col++) {
      delay(delaytime);
      lc.setLed(0,row,col,true);
      delay(delaytime);
      for(int i=0;i<col;i++) {
        lc.setLed(0,row,col,false);
        delay(delaytime);
        lc.setLed(0,row,col,true);
        delay(delaytime);
      }
    }
  }
}

void loop() {
  writeArduinoOnMatrix();
  rows();
  columns();
  single();
}

But I'm still not sure how to get the info I'm recieving from the converter to send a signal to the LEDs, :-[
« Last Edit: August 31, 2009, 02:36:57 am by mbira » Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The first code you give is for TX, and you want RX (receive).
Please use the code I gave you, just change the baud rate to 57600.

And look at this simplified code of the matrix code: this should blink the (4,4) led.
Code:
//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=100;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

void loop() {

lc.setLed(0,3,3,true);
delay(1000);
lc.setLed(0,3,3,false);
delay(1000);

}
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I used your above code, and I do have the LED at 4,4 blinking...and I do have the little onboard RX led giving me an indication that I'm getting something to the board, but the blinking LED doesn't seem to be interacting with the input...it blinks with any or no input. :-?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wait...I'm sure I'm doing something wrong...are you saying to use your code, and then instead of "digital write" put in this last code? I'm sorry I am so new to this, I just don't know!

Do I just replace the words "digital write" with the whole code? :-?  Do I do that for both "digital writes"?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah-I'm sorry, but I'm trying to merge these two pieces of code, and just getting errors because I don't know what I'm doing.  4:30am here, so I'm going to have to sleep and try again tomorrow.  Thank you so much for your help in getting me this far!  I'm glad to know that I want to do is possible.  smiley-grin

Code:
//variables setup
byte incomingByte;

int statusLed = 13;   // select the pin for the LED


//setup: declaring iputs and outputs and begin serial
void setup() {
  pinMode(statusLed,OUTPUT);   // declare the LED's pin as output
  Serial.begin(57600);        //start serial with midi baudrate 57600 or 38400 for debugging
}


void loop () {
  
 if (Serial.available() > 0) {
    incomingByte = Serial.read();
    if (incomingByte==144){ // 144 is note on ch1
      incomingByte = Serial.read();
      if (incomingByte==60){ // 60 is middle C
        incomingByte = Serial.read();
        if(incomingByte>0){  //velocity >0
          digitalWrite(statusLed, HIGH);
        }else{ //velocity=0
          digitalWrite(statusLed, LOW);
        }
      }
    }
 }

}
 

And then...
Code:
//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=100;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

void loop() {

lc.setLed(0,3,3,true);
delay(1000);
lc.setLed(0,3,3,false);
delay(1000);

}
 

Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No!

Analyse this code:

This has to be before the setup() :
Code:
//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,1);

/* we always wait a bit between updates of the display */
unsigned long delaytime=100;
This is the setup
Code:
void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

This is the main loop

Code:
void loop() {

lc.setLed(0,3,3,true);
delay(1000);
lc.setLed(0,3,3,false);
delay(1000);

}
 
lc.setLed(0,3,3,true); is led on col 3 row 3 on.
lc.setLed(0,3,3,false); is the same off


So, now if you understand this:

This is before the setup:
Code:
//variables setup
byte incomingByte;

int statusLed = 13;   // select the pin for the LED

 
This is the setup:
 
Code:
//setup: declaring iputs and outputs and begin serial
void setup() {
  pinMode(statusLed,OUTPUT);   // declare the LED's pin as output
  Serial.begin(57600);        //start serial with midi baudrate 31250 or 38400 for debugging
}
 

This is the main loop, commented.
Code:

void loop () {
  
 if (Serial.available() > 0) { //if serial incoming
    incomingByte = Serial.read(); //read it
    if (incomingByte==144){ // analyse the first byte (status) : 144 is note on ch1
      incomingByte = Serial.read(); //read the next byte

      if (incomingByte==60){ // analyse the second byte (note) : 60 is middle C
        incomingByte = Serial.read(); //read the next byte
        if(incomingByte>0){  //analyse the third byte : velocity >0
          digitalWrite(statusLed, HIGH);
        }else{ //analyse the third byte : velocity=0
          digitalWrite(statusLed, LOW);
        }
      }
      if (incomingByte==61){ // analyse the second byte (note) : 61 is middle C#
        incomingByte = Serial.read(); //read the next byte
        if(incomingByte>0){  //analyse the third byte : velocity >0
          digitalWrite(statusLed, HIGH);
        }else{ //analyse the third byte : velocity=0
          digitalWrite(statusLed, LOW);
        }
      }

    }
 }

}

Merge the two codes :
- before the setup
- the setup
- inside the main loop, digitalWrite(statusLed, HIGH); and digitalWrite(statusLed, LOW); will be basically replaced by lc.setLed(0,col,row,true); or lc.setLed(0,col,row,false);


(Donations welcome!  smiley-razz)
Logged

Pages: [1] 2   Go Up
Jump to: