Just a quick thanks to some of the code I've learned from all of you sifting through the forums. I've had a little background in code and electronics for awhile now, but nothing is as much fun or quick as Arduino!Figured I'd share my first sketch, a quick guess my number game played on a 20X4 LCD screen, using a pot as the input method (tried buttons but found them too tedious)..hope someone finds anything in value from it! Any suggestions on how to clean up the code would be appreciated as well!

if (guess<10){ //this if basically puts a 0 in front of single numbers so // screen doesn't hold numbers when going from 2 digits to 3 digits lcd.print("0"); lcd.print(guess);} else { lcd.print(guess); //if it's 10 or greater just print the number }

if (val==HIGH) { //if our button goes high (pressed) execute the following

if (guess==rndm) { //if our guess matches the random number lcd.setCursor(0,0); lcd.print(" You got it! "); //change the heading to a win if (wronguess<highscore) { //we're still in the if for winning, so update // the high score if it's better than the existing highscore=(wronguess+1); }

if (wronguess>lowscore) {//we're still in the if for winning, so update // the low score if it's better than the existing lowscore=(wronguess+1); }

delay (3000); lcd.clear(); //clear the lcd after 3 seconds

wronguess=0; //reset our guess number numbergen(); //call for another random number and repeat }

void numbergen () { //our random number generator in it's simplest form //the numbers aren't so random using this function, // first number is always 7, and I forget the rest. As shown in other texts //uncommenting out the next line helps //randomSeed(analogRead(1)); //which reads the noise on an empty pin to create a "true random" rndm=random(100);}