Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Watch now!Tune in to Hackster Holidays, Ep. 4 now!
12345hoxdipan
Published

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..

BeginnerFull instructions provided840
How To Make A Random Option Picker Using Arduino??

Things used in this project

Hardware components

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

Hand tools and fabrication machines

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

Story

Read more

Schematics

CIRCUIT DIAGRAM

FOLLOW THIS CIRCUIT DIAGRAM FOR MAKING THIS GADGET.

Code

CODE FOR THIS GADGET

Arduino
FIRST OF ALL DON'T FORGET TO INSTALL LiquidCrystal_I2C.h FROM LIBRARY MANAGER, THEN SELECT PROPER BOARD , PORT AND UPLOAD IT
#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);
              }
                     
}

Credits

12345hoxdipan

12345hoxdipan

1 project • 1 follower

Comments