Cant use Liquid crystal and MIDI at same time?

Hello,

Im trying to write a program using MIDI and LiquidCrystal libraries.

But, I cant use both library at same time.

#include <SPI.h>
#include <LiquidCrystal.h>
#include <MIDI.h>
#include "Controller.h"

LiquidCrystal lcd(12, 11, 8, 7, 6, 5);

MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {
  MIDI.begin(MIDI_CHANNEL_OFF);
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.print("Welcome");
  delay(1000);
  lcd.clear();

}

void loop() {
  
}

This program unable tp print "Welcome" on LCD.

But, If I remove 'MIDI_CREATE_DEFAULT_INSTANCE();' and 'MIDI.begin(MIDI_CHANNEL_OFF);' lines, "Welcome" is printed on LCD.

Im using Arduino UNO board.

What is the reason for this?

What is the reason for this?

Probably a pin conflict, but, who knows? You did not provide a link to the MIDI library that you are trying to use, nor did you provide a link to the Controller library.

Thanks,

This is the library

If you're using SPI you can't also use pins 11 & 12 for the LCD. Assuming this is an Arduino UNO.

NO..Im using only Serial communication with RX and TX pin (1 and 2 in my UNO board).actually that RX and TX used by the MIDI library.

Is there any relationship between SPI and Serial communication via RX and TX?

This code is worked.As you told I have changed 12 and 11 pin
What is the reason for this.
As I nkow RX and TX used by MIDI library.But, it didnt use SPI.

Is there any relationship between SPI and Serial communication via RX and TX? :roll_eyes:

#include <SPI.h>
#include <LiquidCrystal.h>
#include <MIDI.h>
#include "Controller.h"

LiquidCrystal lcd(3, 9, 8, 7, 6, 5);

MIDI_CREATE_DEFAULT_INSTANCE();

void setup() {

  MIDI.begin(MIDI_CHANNEL_OFF);
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.print("Welcome");
  delay(1000);
  lcd.clear();

}

void loop() {

}

Nandika:
Is there any relationship between SPI and Serial communication via RX and TX? :roll_eyes:

I don't think so. Just SPI uses pins 11 and 12, and they were connected to your LCD - if you're not using SPI you should probably remove the include SPI.h line.

I'm using SPI.
I want to drive my LCD using 74HC595.So it need SPI.h

However, MIDI library doesn't use SPI.But, I cant drive LCD using SPI.

?