Show Posts
Pages: [1]
1  General Category / General Discussion / Re: G code viewer on: October 10, 2013, 07:53:52 pm
Thanks for doing this! This is great and exactly what I needed.
2  Forum 2005-2010 (read only) / Interfacing / Re: PS/2 Keyboard Hold and Release on: August 16, 2010, 09:40:35 am
I know that there is no "key up" event listed but I'd like to be able to do figure out how to that.

So if someone knows how to do this then help would be appreciated.



3  Forum 2005-2010 (read only) / Interfacing / Re: PS/2 Keyboard Hold and Release on: August 16, 2010, 09:35:04 am
This works on a Arduino.

As i said: everything is working except the "key up" event.
4  Forum 2005-2010 (read only) / Interfacing / PS/2 Keyboard Hold and Release on: August 16, 2010, 09:12:23 am
Hi

I've got the PS/2 code working, I'm getting signals from the keyboard to the Serial Monitor.

Here is the code i am using:
http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html

My problem is that I can't figure out how to get "key up" events. I want to know when a button is pressed and when it is released.

Thanks,
Árni
5  Forum 2005-2010 (read only) / Interfacing / Re: works: MIDI-IN: code + schematics on: August 11, 2010, 04:44:46 pm
I can't seem to figure this out. Could you please post a modified version of the code I've been using?

I'm going on a tour with my band and i just changed my Audio/Midi interface and now my "light show" is all mono.

6  Forum 2005-2010 (read only) / Interfacing / Re: works: MIDI-IN: code + schematics on: August 11, 2010, 03:30:39 pm
Oh thanks

sorry I missed your earlier posts.

7  Forum 2005-2010 (read only) / Interfacing / Re: works: MIDI-IN: code + schematics on: August 11, 2010, 07:31:15 am
Like Chris L here above I'm having a problem making my Arduino read a poly midi signal.

When I send a MIDI signal from my TC Electronics Konnekt 48 it works fine and polyphonic works, but when I use my MOTU UltraLite it only receives a mono signal.

Here is the code I am using
Code:
//variables setup

byte incomingByte;
byte note;
byte velocity;


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


int action=2; //0 =note off ; 1=note on ; 2= nada


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

//loop: wait for serial data, and interpret the message
void loop () {
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();

    // wait for as status-byte, channel 1, note on or off
    if (incomingByte== 144){ // note on message starting starting
      action=1;
      digitalWrite(statusLed,HIGH);
    }else if (incomingByte== 128){ // note off message starting
      action=0;
      digitalWrite(statusLed,LOW);
    }else if (incomingByte== 208){ // aftertouch message starting
       //not implemented yet
    }else if (incomingByte== 160){ // polypressure message starting
       //not implemented yet
    }else if ( (action==0)&&(note==0) ){ // if we received a "note off", we wait for which note (databyte)
      note=incomingByte;
      playNote(note, 0);
      note=0;
      velocity=0;
      action=2;
    }else if ( (action==1)&&(note==0) ){ // if we received a "note on", we wait for the note (databyte)
      note=incomingByte;
    }else if ( (action==1)&&(note!=0) ){ // ...and then the velocity
      velocity=incomingByte;
      playNote(note, velocity);
      note=0;
      velocity=0;
      action=0;
    }else{
      //nada
    }
  }
}

void blink(){
  digitalWrite(statusLed, HIGH);
  delay(1000);
  digitalWrite(statusLed, LOW);
  delay(1000);
}


void playNote(byte note, byte velocity){
  int value=LOW;
  if (velocity >10){
      value=HIGH;
  }else{
   value=LOW;
  }

 //since we don't want to "play" all notes we wait for a note between 36 & 44
 if(note>=36 && note<44){
   byte myPin=note-34; // to get a pinnumber between 2 and 9
   digitalWrite(myPin, value);
 }

}


Anyone else seen this?
Pages: [1]