pushbutton using switch case program

can someone send me codes of a pushbutton with multiple functions using the switchcase statement. I badly need it. :((

What kind of pushbutton?
Matrix keypad
IR remote
individual switches.

What is this for?

.

Its for our activites in school. We are using a momentary pushbutton

You could push a switch a certain number of times, let's say 4 times which increments a counter.
Then use this counter and 'switch case' to run different functions as needed.

.

i know this is too much to ask but can you give me a sample code of that?

Show us the functions you want to run?

.

if pushbutton is pressed once then LED is on, if pushbutton pressed long, LED off.

If that's all you need look at Mr. Gammon's 'Switch Manager' library.

Read this, then look at Nick's library:

Library here:
http://gammon.com.au/Arduino/SwitchManager.zip

.

https://www.arduino.cc/en/Reference/SwitchCase

can someone send me codes of a pushbutton with multiple functions using the switchcase statement.

Its for our activites in school. We are using a momentary pushbutton

Normally, I enjoy doing kids homework for them. It's amusing, and the result (they don't actually learn anything) serves them right. But in this case, I have no idea what this person might want.

OP: could you possibly post the text of the question or assignment you were given?

Oh, and 'code' in this context is a mass noun. There is no such thing as 'codes', unless you are talking nuclear launch codes. It is not the case that each line in a chunk of code is one code.

If you want to know more abut mass nouns, study your english textbooks. If you want to know more about switch statements, study your CS books. If you want people to do your CS assignments for you, please post the actual assignment.

Im sorry my english is bad :frowning: please bear with me :frowning: :slight_smile:

The instructions given to us was to create a program in arduino. A pushbutton having at least 2 functions.

Function 1:
Button is pressed for a given period of time then do something to the OUTPUT(LED)
Function 2:
Button is pressed multiple times then do something to the OUTPUT(LED)

bembe24:
Im sorry my english is bad :frowning: please bear with me :frowning: :slight_smile:

The instructions given to us was to create a program in arduino. A pushbutton having at least 2 functions.

Function 1:
Button is pressed for a given period of time then do something to the OUTPUT(LED)
Function 2:
Button is pressed multiple times then do something to the OUTPUT(LED)

You mean the instruction wasn't to go on the internet and make someone else do it for you? Sounds like they want you to like, learn or something.

INTP:
Sounds like they want you to like, learn or something.

I think you're right, but I don't think the OP does.

I only asked for help or at least an advice. I didn't specifically said to do the those experiments for me. Anyway, thanks for the help Larry D :slight_smile:

bembe24:
I only asked for help or at least an advice. I didn't specifically said to do the those experiments for me.

bembe24:
i know this is too much to ask but can you give me a sample code of that?

Except you did. Turn in 'sample' code, learn nothing.

even if my english is really that bad i think theres a big difference between SAMPLE and ACTUAL code.
Well maybe i cant blame you if you misunderstood me. Im sorry

The links Larry and I gave you have all the 'samples' you need to accomplish your assigned task.
When you still ask for help as if you didn't even bother to read the links, you make us all think what you really want is someone to do it for you.

i didnt actually asked for further help. I only answered what PaulMurrayCbr asked of me. Plus i am new to this forum so im sorry if i showed up and looked like i asked so much.