need arduino teachers to help me out please

hi, my names jake. ive been messing around with my arduino for a while now to try and make a reef controller. unfortunately my reef is gone so now im using it solely for one project... a random trick generator
here was it needs to do..
-have 4 seperate lists of snowboard tricks (easy jump trick, hard jump trick, easy rail tricks, hard rails tricks)
-display the trick name when button is pressed (button 1 = easy jump. button 2 = hard jump, ect...)
-displays the trick name on 16 x 2 lcd for X seconds before going to an idle screen

can some of you guys please help me out? i have been searching google for help and past posts but the problem is i dont understand it very well. thanks so much for your time.

What is it you are having difficulties with? There are plenty of examples of how to read switch pressed, how to connect and write to an LCD, how to generate a random number, etc.

None of what you want to do is difficult. It just needs to be pieced together.

If you have trouble with the hardware, say so. If you have trouble with the software, show what you have, and describe what it does that you don't want, or does not do that you want.

hey paul, thanks for responding. sorry for being vague but i guess we can start on step 1, the wiring. im not to sure on how to accually wire together the arduino to the buttons and the lcd screen. how can i wire the lcd to the arduino its a standard 16 x 2 lcd? im really sorry for being this pathetic are this and the arduino language but i gotta start somewhere. thanks

its a standard 16 x 2 lcd?

There really isn't such a thing as a standard LCD. A link to the specific LCD that you have is necessary, and should already include a wiring diagram. You could look here:
http://arduino.cc/en/Tutorial/LiquidCrystal
to see if yours is compatible.

The switches are pretty easy:
http://arduino.cc/en/Tutorial/Button

"compatible with the Hitachi HD44780 driver" thats what i ment by standard. but after reading the switch guide i have it wired the same way but with 2 to start. the first button is pin 1, the second is pin 2. now for the lcd...

i wired the lcd like the picture on that page you sent so believe all the physical parts are done then correct? (except for adding those last 2 buttons which ill do when i get a better understanding of the code and arduino language)

i wired the lcd like the picture on that page you sent so believe all the physical parts are done then correct?

Does the sample Hello World application make text appear on the LCD? If so, then it is connected correctly.

Does the sample switch sketch work? If so, then the switches are connected correctly.

its displaying text but is not lighting up.

nevermind, i added wires to 16 and 15 and it lit right up.
nw how do i connect the first button to the lcd? i dont know how to write it in arduino program. im sorry for the headaches im causing :~

how do i connect the first button to the lcd?

You don't connect switches to the LCD. You connect switches to the Arduino, as shown in the other link.

It sounds like what you need to do is break it apart so that you understand how each part is working. It sounds like you have the LCD with the example sketch running so thats good, probably the hardest part. Now what you should do is just put an LED (resistor!) on one of the digital pins and do the button example sketch that blinks the LED when pressed. Then use that same LED and use the random function to make it blink at random intervals.

Once you have a basic understanding of how that works just put all three together and you'll be set. For the random trick names I would suggest you make four string arrays, one for each type of trick. Then assign each of your 4 buttons to one of the arrays and use the random function to call one of the strings each time that button is pressed.

This is just rough quasi-code but it should be something like:

declare your strings with all of your data
int buttons[] = {2,3,4,5};

void setup(){
pinMode...
}

if (digitalRead(buttons[0]) == HIGH) {
display to LCD a random string from your first string array
}

repeat...

I've not done any work with string arrays or LCDs so I don't honestly know the specific functions you will need to write or how you will want to declare your data but I'm sure with some research (reference and examples are your friends) you can figure it out. I hope this helped. Also arrays can greatly simplify your code and make it easier to change in the future which is why I declared your button input pins in an array, that way you you can make a for statement that will constantly examine all 4 pins sequentially. And also dealing with what pins are your inputs becomes very easy.

thank you so much for the help! im gonna (try!) to write a sketch and see if it work a little bit, ill post it as soon as i finish it.

If your having coding issues post your code and I can help you out. Writing code is one of my favorite parts of arduino projects haha

i added wires to 16 and 15 and it lit right up.

Did you check if you needed any series resistors. If you connect the LEDs direct to 5V they won't last long, resistor of 20 to 40 ohms are normal. Sometimes these are included in the board but often they are linked out.

oh no i meant the lcd screen sorry, the back light wasnt on for it but problem solved!! haha. but i did what you said and added an led to the circuit and its working perfectly!

the next step is how do i add my 4 lists of trick on the code?

but heres the code so far..

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int hardjump = 6; // the pin for hardjump button
const int ledPin = 13; // led that will blink
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(hardjump, INPUT);

lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("select a trick");
}

void loop()
{
// read the state of the pushbutton value:
buttonState = digitalRead(hardjump);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);

// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
}

Ok so I've noticed a few things. First of all always use the code feature when posting code so that its easier to read. Second of all um not sure what the purpose of the time since reset but that is going to be the time since the arduino was reset not the button. This may be what you want but I'd you want it to show time since the message was reset add a different variable called resetTime or something and every time the button is pressed say resetTime = millis() and then on the else statement instead say millis() - startTime.

When I get home ill work in the text string bit for you. Also didn't you want 4 buttons? I'd so then the method you used for the one button will work fine just add some more variables.

ya i forgot to delete that time since restart haha but i accually am not sure how to add 3 more variables... ya im really bad at this.
but thank you SO much for helping me out, am very grateful.

Yeah I'm happy to help out, I've gotten a ton of help from this forum so I guess its like paying back haha. And to add more variables you just do like the other variables in there. What you want to do is this

int (insert variable name here) = (add value here)

You don't have to use int either. That's just the most common. Go to the reference page and look at the data types. int stands for integer btw.

If you meant that you don't know how to add more buttons ill write up some code when im home and not typing everything on my android haha

no rush at all haha, but ya i just dont even know where to start. i guess i can do
{
int button1 = 6
int button2 = 7
int button3 = 8
int button4 = 9
}

but that just for imput pins, im gonna keep researching though.

You don't need the { or }
These declarations are put at the start of the sketch before any functions.

Alright here you go. I'm not 100 percent sure it works because I dont have my arduino. I'll post 2 different ways. The second doesn't use the 3d array (which wouldn't compile, maybe Grumpy_Mike can help me out) but is less elegant :frowning:

 #include <LiquidCrystal.h>
 
// initialize the library with the numbers of the interface pins
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
 const int button[] ={6,7,8,9};     // the pins for the buttons
 const int ledPin =  13;      // led that will blink
 boolean buttonState[] = {false, false, false, false};         // variable for reading the pushbutton status
 unsigned long resetTime;
 
 //char* easyJump[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //insert your trick names between the quotes
 //char* hardJump[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //these are arrays of arrays hence the pointers
 //char* easyRail[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //if this is confusing to you (it most likely is)
 //char* hardRail[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //look at the char array page on reference
 
 char* tricks[4][6] = {     //[y][x]
            {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"},  //I'm going to use this in the code but I'm not 100% sure C permits it
            {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"},  //See comments above for an explaination
            {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"},  
            {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"}
          };   
 

void setup() {
   pinMode(ledPin, OUTPUT);      
   
   for (int i = 0; i < 4; i++){                 //Goes through each element of the array
     pinMode(button[i], INPUT);
   }
   
  lcd.begin(16, 2);
   // Print a message to the LCD.
   lcd.print("select a trick");
 }
 
void loop(){
  for (int i = 0; i < 4; i++){
    buttonState[i] = digitalRead(button[i]);      // read the state of the pushbutton value:
  }
  
   for (int i = 0; i < 4; i++){
     if (buttonState[i] == HIGH) {                // check if the pushbutton is pressed.
                                                  // if it is, the buttonState is HIGH: 
       digitalWrite(ledPin, HIGH);                // turn LED on:    
       lcd.setCursor(0, 1);
       lcd.print(tricks[i][random(6)]);           //this will use the 3D array of info to pull a
       delay(3000);                               //random trick name from its corresponding grouping
       resetTime = millis();                      //I'm not sure if you want the delay or not but you can figure it out
     }                     
     else {
     digitalWrite(ledPin, LOW);                   // turn LED off:
     
     lcd.setCursor(0, 1);                         // set the cursor to column 0, line 1
                                                  // (note: line 1 is the second row, since counting begins with 0):
     lcd.print((millis()-resetTime)/1000);                    // print the number of seconds since reset:
     }
   }
}

So a few side notes. I changed the millis() thing like I suggested. Also I added the part that will display the trick name. The delay may be unnecessary and maybe even cause problems so just play around with it. This uses a 3d array with pointers which is a pretty advanced concept which is pretty confusing, its not working but maybe Grumpy_Mike knows a way to initialize it. I made heavy use of arrays so if thats confusing look at the reference page for arrays and it should help.

#include <LiquidCrystal.h>
 
// initialize the library with the numbers of the interface pins
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
 const int button[] ={6,7,8,9};     // the pins for the buttons
 const int ledPin =  13;      // led that will blink
 boolean buttonState[] = {false, false, false, false};         // variable for reading the pushbutton status
 unsigned long resetTime;
 
 char* easyJump[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //insert your trick names between the quotes
 char* hardJump[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //these are arrays of arrays hence the pointers
 char* easyRail[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //if this is confusing to you (it most likely is)
 char* hardRail[] = {"first", "second", "third", "fourth", "fifth", "sixth", "seventh"};   //look at the char array page on reference
 
void setup() {
   pinMode(ledPin, OUTPUT);      
   
   for (int i = 0; i < 4; i++){                 //Goes through each element of the array
     pinMode(button[i], INPUT);
   }
   
  lcd.begin(16, 2);
   // Print a message to the LCD.
   lcd.print("select a trick");
 }
 
void loop(){
  for (int i = 0; i < 4; i++){
    buttonState[i] = digitalRead(button[i]);      // read the state of the pushbutton value:
  }
  
   for (int i = 0; i < 4; i++){
     if (buttonState[i] == HIGH) {                // check if the pushbutton is pressed.
                                                  // if it is, the buttonState is HIGH: 
       digitalWrite(ledPin, HIGH);                // turn LED on:    
       lcd.setCursor(0, 1);
       switch(i){
         case 0:
         lcd.print(easyJump[random(7)]);           //this will use the 3D array of info to pull a
         break;
         case 1:
         lcd.print(hardJump[random(7)]);           //change the number there for the number of tricks in each group
         break;
         case 2:
         lcd.print(easyRail[random(7)]);          
         break;
         case 3:
         lcd.print(hardRail[random(7)]);           
         break;
       }
       delay(3000);                               //random trick name from its corresponding grouping
       resetTime = millis();                      //I'm not sure if you want the delay or not but you can figure it out
     }                     
     else {
     digitalWrite(ledPin, LOW);                   // turn LED off:

     lcd.setCursor(0, 1);                         // set the cursor to column 0, line 1
                                                  // (note: line 1 is the second row, since counting begins with 0):
     lcd.print((millis()-resetTime)/1000);                    // print the number of seconds since reset:
     }
   }
}

This one would compile fine so it should work hopefully. Notice the case statement used to differentiate between which group to draw from depending on which button is pressed.