Entering number using push buttons

Does anyone know how to type a mobile number in lcd display using Arduino with just 2push buttons. Pls help me

One button.. held down for 300ms ... number keeps going up. Button released number selected... moves to next number.

What @red_car said works, but I would use the second button as a confirmation button.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

Yes I want how to make the code , can you pls help me also it has to move the cursor

... but is also very cumbersome if you want to enter a number with many digits.

Post #9 here shows how to do what you want, but it's specifically for the dfr0009 shield. if you don't have that shield, it may give you some ideas though. It allows you to click along to any digit and then change that digit alone.

It pushes onto an Uno.

is that possible for oled screen?

The beauty of programmable micro-controllers is that the answer to that is very likely "yes"... but you need to write the code.

If my memory serves me though, oled screens work at the pixel level not the character level, so it may be more difficult to do. You will need to experiment.

but idk how to code them
can you help me with this please

My reply #8 now looks silly since the OP removed the question s/he asked in #7 :rage:

i cant do with the shield , all i need is to use with just normal push buttons

Have you done any programming at all? There are many example programs you should work with before you try to do even a simple project like this.

We are not here to write code for you. We are not here to hold you hand and drag you over every little detail that you stumble upon.

You need to start at the beginning. Post the attempt you have made to solve your problem, and where you are having trouble making it follow the plan you have laid out for how your sketch will function.

a7

yea after trying a lot i am vexed of that and i came up here
anyway lemme post my tries

#include <LiquidCrystal.h>
int seconds = 0;
int a=0;
int b=0;
int count=0;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
Serial.begin(9600);
lcd.begin(16, 2); // Set up the number of columns and rows on the LCD.
pinMode(6,INPUT);
pinMode(7,INPUT);

// Print a message to the LCD.
lcd.print("hello world!");

}

void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting
// begins with 0):
lcd.setCursor(0, 1);
a = digitalRead(6);
b = digitalRead(7);

if (a==HIGH){
count = count+1;
while(digitalRead(6)) {}}

if (count==1) {
lcd.print("1");
}

if (count==2){
lcd.print("2");

} if (count==5){
lcd.print("5");

} if (count==6){
lcd.print("6");

} if (count==7){
lcd.print("7");

} if (count==8){
lcd.print("8");

} if (count==9){
lcd.print("9");

}
if (count==10){
lcd.print("0");

}

}

Use the </> button.


Perhaps you would need to register single button presses, double presses, and long presses?
Maybe this would help: EasyButton - Arduino Reference

yea this is good, but how to print it on the lcd or oled

I mean I know this but I am asking like
if you press button-1 that's gonna print 1 then if you keep pressing it, that's gonna go till 0-9
and if you press button-2 that should change the cursor and again if I press button-1 it should again print 0-9 and after entering the number , if I press button-3
that should save the number in some variable.....This is what I exactly want
can you help me with this

How are your buttons wired? Do you have a pull-down resistor? The way you have it coded implies you do.