icon
How To Make A Random Option Picker Using Arduino??

Hi, in this project I have explained that how can you make a random option picker with Arduino and LCD. This project is just for fun..

projectImage

Things used in this project

 

Hardware components

HARDWARE LIST
1 Arduino UNO
1 DFRobot I2C 16x2 Arduino LCD Display Module
1 Resistor 1k ohm
1 DFRobot Gravity:Digital Push Button (Yellow)

Hand tools and fabrication machines

Breadboard, 170 Pin
Premium Male/Male Jumper Wires, 40 x 3" (75mm)

Story

Intro:- Sometimes people get confused that what should them to choose, but this project will generate one option between multiples to make decision fast....

 

WARNING:-THISPROJECTISONLYFORFUN:)DON'TUSETHISGADGETFORTAKINGSERIOUSDECISIONS,THEOPTIONISGENERATEDRANDOMLYBYARDUINO.

 

YOU MAY WATCH THis TUTORIAL BELOW-

Now after you make the circuit you have to install LiquidCrystal_I2C.h library.

 

For that, gotoSketch--->IncludeLibrary----->ManageLibrarys----->SEARCH"LiquidCrystal.h"

 

Then simply install this library.

 

You may Compile this sketch once.

 

Next step is to select proper BOARD and PORTS

 

(Remember somethimes Arduino shows error due to wrong selection of board and ports)

 

Now it is ready to Upload.

 

If you still get any error then you can comment me.

 

IFYOULIKEDTODAY'SPROJECTTHENPLEASEFOLLOWME :)

Schematics

 

projectImage

CODE

CODE
#include<LiquidCrystal_I2C.h>
//INSTALL THIS LIBRARY FIRST

LiquidCrystal_I2C lcd (0x27,16,2);

int button=8;//CONNECT BUTTON TO DigitalPin 8

char *options[]={"First option","Second Option"}; 
long option1;

void setup(){
  lcd.init();
   lcd.backlight();
    pinMode(button,INPUT);
    randomSeed(500);
      
           
}
void loop(){

    
      
      
                  int state=0;
                      state=digitalRead(button);

              if(state==HIGH){
                         
                             option1 = random(sizeof(options)/sizeof(char*));
                        lcd.clear();
                         delay(1000);

                              lcd.print("PROCESSING....");
                                  lcd.blink();

                    delay(4000);
                            lcd.clear();
                            lcd.setCursor(0,0);
                            lcd.print("I CHOOSE:-");
                                        
                             lcd.setCursor(0,1);
                     lcd.print(options[option1]);
                     delay (5000);
                     lcd.clear();
                           
                           
          
              }

              else{
                lcd.setCursor(0,0);
                lcd.print("Press to start");
                lcd.blink();
                delay(200);
              }
                     
}

The article was first published in hackster, July 23, 2021

cr: https://www.hackster.io/12345hoxdipan/how-to-make-a-random-option-picker-using-arduino-d88fb0

author: 12345hoxdipan

License
All Rights
Reserved
licensBg
0