Saturday, 6 December 2014

Improvements and Fixing Issues

Improvements

The next step to upgrading from my Prototype, was to get the LED's to turn off after the key was released. Basically to understand note off signals. This has been a real struggle however and after hours of trying I still can't find a way to get the Arduino to register this. My idea seems ok enough and should work.

My idea is to use Max, to understand that when the note is released, it send a signal of 0 to the Arduino. In the code, the Arduino should register 0 and as a result of he 'else' function, all LEDs should turn off. However, getting Max to send a 0 has proved difficult. This is my next step and will continue working on it. Below is a screenshot of the Max patch in working progress, on the left is where I test the Max patch, and the right is where I build the tests before testing them.


Fixing Issues

A real issue I had with my Prototype was that one of the LEDs was always dimmer than the other two. I had a few theories to why this could be. First I thought it was the LED itself, but after switching LEDs around, it wasn't that. I always tried switching cables, resistors, even outputs from the Arduino. This became an issue I figured I would fix at a later date.

However, today I was reading back over my Arduino code, and I noticed something was missing. Below is the area I noticed the issue.

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin7, OUTPUT);
  pinMode(ledPin6, OUTPUT);
}

I realised that I never setup ledPin5 to be an Output! As a result, Arduino never considered the 3rd LED to be an Output signal, which meant a dim LED. All I had to do was change the code to this:

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin7, OUTPUT);
  pinMode(ledPin6, OUTPUT);
  pinMode(ledPin5, OUTPUT);
}

The Arduino now registers ledPin5 as an Output so now the LED receives the High voltage when triggered by the MIDI keyboard.

No comments:

Post a Comment