How to implement enum in arduino and track the state I'm in?

I'm currently working for a button click task. Like writing code for button click if certain time has elapsed. Also use enum in that and make it explicit declaration.

Just post the assignment - don't try to paraphrase, it wastes time

1 Like

There is no specific implementation for enum on an Arduino. You can use enum - yes even an enum class - as you are used to it for any other microcontroller you program in c++11.

See the OneButton Library for inspiration.

If you need some idea of how to implement a timer and a button class see my Tool Kit library:
https://werner.rothschopf.net/microcontroller/202203_tools_button_en.htm

Just post the full assignment

1 Like

Example 4 here uses an enum in a state machine:

https://www.gammon.com.au/statemachine

1 Like

Hello
My chrystal ball is in the dish washer again.
You should describe in simple words what your shall project shall do and this very simple.

I don't understand what you mean

1 Like

Hello
Post your sketch you have designed until to see how we can help.

What have you tried and where are you stuck?

...and where exactly does 'definedTime' get set?

So it's a constant?

yes, i have taken it for example

Please save us a lot of time and post your entire sketch.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.