Pages: [1]   Go Down
Author Topic: Hoping for help in using serial input to control shift register (MIDI related)  (Read 520 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

Hi folks,
I am needing to send a midi signal through the midi2serial converter.  

I am using THIS shift register, in order to control 32 individual LEDs.

Can anyone help me on modifying the Shift Register code to accept the midi serial signal to light specific LEDs in the matrixs?  

I'm hoping to modify this code to meet my needs:
http://arduino.cc/en/Tutorial/ShftOut12

I'm confused about a) how the midi signal going into the midi 2 serial converter looks coming out the other end.  (IE: does each midi message turn into an array, or what??)  Each MIDI signal will be something like (144, 60, 124) and b) how the shift register sketch responds to the MIDI signal. 

I need something like:

if ( First bit = 144) {
   if (second bit = 60) {
       ...light LED #1...
      }
   if (second bit = 61) {
      ...light LED 2...
      }

etc, etc



Thanks so much for any help!
« Last Edit: October 01, 2011, 09:34:08 pm by mbira » Logged

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

Should I be asking this question in the programming sub-forum? 

Thanks!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31395
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

First learn how to cascade 4 shift registers.
You will need a long int to hold all 32 bits.

Your code then needs to simply set or clear the single bit corresponding to the LED you want to light / turn off in that long int.
Use the bit set, bit clear functions for this.
Then you shift the whole lot out to the shift registers.

Quote
a) how the midi signal going into the midi 2 serial converter looks coming out the other end.
As this is software it simply directs the bytes you send it into the MIDI channels, and send you the bytes from the MIDI channels to the serial port which you read like any other serial input stream.
Quote
Each MIDI signal will be something like (144, 60, 124)
Yes and those are the bytes you will receive over the serial port.

Quote
how the shift register sketch responds to the MIDI signal
Well until you change it there will be no effect because you are not looking at any serial input.

This project might help you parse the incoming MIDI signals.
http://www.thebox.myzen.co.uk/Hardware/Glockenspiel.html
Logged

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

Hi Grumpy_Mike.  Thanks for your post.  I jumped over to the programming sub-forum, because I was thinking that was a more suitable place to ask my question.  Currently, I can:

Send up to 8 MIDI notes out through the converter and into the Shift Register.  I am still only using the first chip (8 output pins) because I'm trying to get all the functionality correct before I add the other three chips. 

I'm running into an issue though because I am needing to light more than one LED at once, and the code as written turns off one LED when I turn on the next.  The thread I started on this subject is here:
http://arduino.cc/forum/index.php/topic,74344.0.html
Logged

Pages: [1]   Go Up
Jump to: