new to arduino need help

iam very new to arduino and i wanted to make a little project

a found and wanted to make this mtg life counter

but i want to this this lcd shield

DFrobot lcd shield

i can make the screen to work but not the buttons....be easy with me pls its very new to me

all the help is much appreciate

that shield a single analog input to know what button is being pressed also there a libraries that need to be added. if you are new, I would recommend following instructions and doing exactly what they say with the same parts. that way if you need help you'll most likely get it because the instructions can be shared.

i add the libraries to the sketch the ones that i found in dfrobot site tried some different from the internet no luck,i cant understand how to modify the sketch to add the analog buttons...:frowning:

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

post your code (properly) that way we can see it

this is the original code

/**
  *  ArduinoMLC - Magic Life Counter
  *  
  *  Authors:  Fernando Concatto (GitHub:concatto)
  *            João Felipe Gonçalves (GitHub:jfrode)
  */


#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

//Players score
int player1 = 20;
int player2 = 20;
int manaPlayer1;
int manaPlayer2;

int who = 1;

// Buttons declaration
int buttonAdd = 8;
int buttonSub = 9;
int buttonSwitch = 10;

// Buttons states
boolean pressedAdd = false;
boolean pressedSub = false;
boolean pressedSwitch = false;

String manaNames[5] = {
  "White", "Blue", "Black", "Red", "Green"
};

byte manaCharacters[5][8] = {{
  // White
  B00000,
  B10101,
  B01110,
  B11111,
  B01110,
  B10101,
  B00000,
  B00000
}, {
  // Blue
  B01000,
  B00100,
  B01110,
  B11111,
  B11011,
  B11001,
  B01110,
  B00000
}, {
  // Black
  B00000,
  B01110,
  B10101,
  B10101,
  B11011,
  B01110,
  B10101,
  B00000
}, {
  // Red
  B01100,
  B00010,
  B00001,
  B01101,
  B11011,
  B11101,
  B10110,
  B01100
}, {
  // Green
  B01010,
  B10101,
  B01110,
  B10101,
  B01110,
  B00100,
  B00100,
  B00000
}};


void setup() {
  pinMode(buttonAdd, INPUT);
  pinMode(buttonSub, INPUT);
  pinMode(buttonSwitch, INPUT);
  lcd.begin(16, 2);
  for (int i = 0; i < 5; i++) lcd.createChar(i+1, manaCharacters[i]);
  introduction();
  manaChoosing();
  diceRoll();
  reprint();
}
 
void loop() { 
  if (digitalRead(buttonSwitch) == HIGH) {
    if (!pressedSwitch) {
      if (who == 1) {
        who = 2;
      } else {
        who = 1;
      }
      pressedSwitch = true;
    }
  } else {
    pressedSwitch = false;
  }
  
  if (digitalRead(buttonAdd) == HIGH) {
    if (!pressedAdd) {
      if (who == 1) {
        player1 = player1 + 1;
      } else {
        player2 = player2 + 1;
      }
      reprint();
      pressedAdd = true;
    }
  } else {
    pressedAdd = false;
  }
  
  if (digitalRead(buttonSub) == HIGH) {
    if (!pressedSub) {
      if (who == 1) {
        player1 = player1 - 1;
      } else {
        player2 = player2 - 1;
      }
      reprint();
      pressedSub = true;
    }
  } else {
    pressedSub = false;
  }
}

void reprint() {
  lcd.clear();
  
  lcd.setCursor(5, 0);
  lcd.write(manaPlayer1);
  lcd.setCursor(7, 0);
  lcd.print(player1);
  lcd.setCursor(10, 0);
  lcd.write(manaPlayer1);
  
  lcd.setCursor(5, 1);
  lcd.write(manaPlayer2);
  lcd.setCursor(7, 1);
  lcd.print(player2);
  lcd.setCursor(10, 1);
  lcd.write(manaPlayer2);
}

void diceRoll() {
  
}

void manaChoosing() {
  manaPrint(0, 0);
  
  manaPlayer1 = manaSelect(0);
  manaPlayer2 = manaSelect(1);
  
  pressedAdd = false;
  pressedSub = false;
  pressedSwitch = false;
}

int manaSelect(int line) {
  int manaColor = 0;
  while(true) {
    if (digitalRead(buttonAdd) == HIGH) {
      if (!pressedAdd) {
        manaColor++;
        pressedAdd = true;
      }
      manaPrint(manaColor, line);
    } else {
      pressedAdd = false;
    }
    
    if (digitalRead(buttonSub) == HIGH) {
      if (!pressedSub) {
        manaColor--;
        pressedSub = true;
      }
      manaPrint(manaColor, line);
    } else {
      pressedSub = false;
    }
    
    if (digitalRead(buttonSwitch) == HIGH) {
      return manaColor;
    }
    
    if (manaColor > 4) manaColor = 0;
    if (manaColor < 0) manaColor = 4;
  }
}

void manaPrint(int manaColor, int line) {
  lcd.clear();
  
  lcd.setCursor(0, line);
  lcd.print("Player "); // <-
  lcd.print(line+1);    // How to concat?
  
  lcd.setCursor(9, line);
  lcd.write(manaColor + 1);
  
  lcd.setCursor(11, line);
  lcd.print(manaNames[manaColor]);
}

void introduction() {
  lcd.setCursor(0, 0);
  lcd.print("Concatto &");
  lcd.setCursor(7, 2);
  lcd.print("JFRode");
  delay(2500);
  lcd.clear();
  
  lcd.setCursor(0, 0);
  lcd.print("MagicLifeCounter");
  lcd.setCursor(5, 1);
  for (int i=1; i <= 5; i++)  lcd.write(i);
  delay(3500);
}

for the single analog input you need to have "int" for each analogRead value then assign them to like you would with a digitalRead….
if you look up a youtube channel called "the workshop" he has a working with LCD tutorial that discusses the shield you want to use.