Arduino (C/C++) Code To Display Contents of Array on LCD -


i've tried researching before posting this, new programming, general ignorance @ point preventing me being able know how ask right questions.

current goals:

  1. building array stores 50+ english words/phrases;
  2. access array on arduino, , have individual words/phrases display on lcd; and
  3. toggle through words/phrases clicking button on arduino.

hardware specs: sainsmart unor3, lcd based on hd44780

issue: writing code display new word when push button.

code "hello, world!" lcd

void setup() {  // set lcd's number of columns , rows:    lcd.begin(16, 2);   // print message lcd.   lcd.print("hello, world!"); }  void loop() {   // set cursor column 0, line 1   // (note: line 1 second row, since counting begins 0):   lcd.setcursor(0, 1);   // print number of seconds since reset:   lcd.print(millis()/1000); } 

code random string array

#include <stdio.h> #include <stdlib.h>  int main() {     const char *messages[] = {         "hello!",         "how you?",         "good stuff!"     };     const size_t messages_count = sizeof(messages) / sizeof(messages[0]);     char input[64];     while (1) {         scanf("%63s", input);         printf("%s\n", messages[rand() % messages_count]);     }     return 0; } 

i have arduino uno , lcd display. task going to both debug hardware , software. so, let me ask questions.

in code listing, when run sketch "hello world!" display @ lcd?

how main() provided relevant problem. specifically, main() running? hope not part of sketch!!

in loop() not have delay. @ starting programmer... when displaying want pause few seconds, otherwise going drive lcd thousands of changes per second.

so add delay(3000); statement delay 3 seconds (3,000 milliseconds), between updates lcd.

next, in 'loop()` need test button push, lcd display.

please stuff , update question accordingly, , follow-up more suggestions/questions.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -