Kiran Kumar
Published © GPL3+

Number Guessing System With Arduino

With this system, guess the number in between any range required according to the situation.

BeginnerShowcase (no instructions)5,929
Number Guessing System With Arduino

Things used in this project

Story

Read more

Schematics

Pin Diagram.

Code

Number Guessing Code

C/C++
all the instructions are briefly mentioned in program with the help of comments.
// include the liquidcrystal library code:
#include <LiquidCrystal.h>

// it extends the size of randNumber
long randNumber;

// defines the constant values
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  
}

void loop() {

  // lcd first column code
  // begin the lcd display
  lcd.begin(16, 2);
  // print below text
  lcd.print("Number Guessing");
  analogWrite(6,100);
  // delay half second
  delay(500);
  
  // "lcd second column and first to forth code"
  lcd.setCursor(0, 1);
  // print below text
  lcd.print("No : ");
  analogWrite(6,100);
  // agian delay of half second
  delay(500);
  
  // "random number ganerator code"
  
  // set cursor
  lcd.setCursor(5,1);
  // get a number from random function
  randNumber = random(0,10000);
  // print random number on lcd
  lcd.print(randNumber);
  analogWrite(6,100);
  // again delay 5 second
  delay(5000);
  // clear screen
  lcd.clear();
  delay(500);
  
}

Credits

Kiran Kumar

Kiran Kumar

0 projects • 2 followers
Developer @ Scenario Sity

Comments