creating a pin

i need to create a program where The six switches should enable a user to type in a PIN and change the message on the LCD
The LCD should begin with the message Enter Code. If the switches are pressed in the order 2 6 5 3 1 4 then the message should change to Code Accepted. Getting the order wrong triggers an Error message and the program restarts a few seconds later.

What LCD, what switches and what arduino are you using?

Tom… :slight_smile:

You made the mistake of revealing your secret password.

You made the mistake....

.... of crossposting

how do i do this?

You are completely clueless about Arduino but you know exactly how to do crosspostings in a forum?

Did you read the forum rules about crossposting?
Did you read the forum rules about meaningful headlines?

As far as I know, all Arduino boards come with pins ready-to-use, so you don’t have to “create a pin” when using an Arduino developer board of some kind.

Crossposts merged.

Please do not crosspost as it wastes time.

As far as I know, all Arduino boards come with pins ready-to-use, so you don't have to "create a pin" when using an Arduino developer board of some kind.

He means PIN, as in Personal Identification Number.

He means PIN, as in Personal Identification Number.

The list of smileys here is grossly deficient in the one for tongue-in-cheek.

Hello Sam,

You mention a lot of things, switches and LCD… For starters do you have 6 pins available when your LCD is connected? Show us how much of the program you have so far. I do not know where to start helping you. Which arduino are you using?

Welcome to the wonderful world of Arduinos.
if you break down your task into steps you can achieve, you will get to your goal soon enough.
I would give you a steep target of getting in the numbers and then printing out the sequence.

you need to learn about interrupts.
about if() statements
serial print
combining values in a chain.

there is phase II, comparing what you have entered, but that is a task that needs a separate thread

when the first number is put in, that number needs to be saved and the next ‘slot’ ready to accept the next number.

your project needs to be broken down into just data entry, forget the display at the moment.
which Arduino in unimportant at this time as well.

I think the firs thing is what you are using for the switch inputs.
10 separate buttons ? or maybe a keypad ?

10 buttons would be the easiest to get started with.
if you have a keypad, figure out how to talk to that.
once you can accept a single button, then,

when a key is pressed, you need to store that number
second key, store that number
when you press a number, I would toggle an internal register. count up to 6.

since we expect that the keypress will start the program AND need to store that number, we could go with an interupt.

store the first number
if (counter =6) jump to ‘comparison’ // read about state machines and create the comparison area

if(counter=2) store next number in bin-2
if(counter=3) store next number in bin-3
and so on.

at this point, you have a task that you can achieve.
when counter=6, blink a light and then serial print something like you pressed, 336591

once you can get to this point, you will have a lot of knowledge and familiarity with programming and with your tools.

your next questions will be easier for us to address.

I don't think you need interrupts for this... from what ive read, you should only use interrupts if there is no other way..

you just need to poll the buttons, recognize and store when they are pushed, the order that they are pushed, a certain amount of time to just time out, then test if the code entered is correct.

I agree that the first step should be to get one button working. you can test it Serial.print.

just search for Arduino button and you can get started

getting the buttons working in the first real step.
if you use a keypad,

this will even start you off with serial print.

once you have that working, then all you need to do is to store each value.