I am new to programming. This is my very first program, and I do not know why it doesn't work, as I have no knowledge of programming. Please help
Everything is ok now```
I am new to programming. This is my very first program, and I do not know why it doesn't work, as I have no knowledge of programming. Please help
Everything is ok now```
I got that it is something to do with strings vs ints, but how exactly do I do this?
Explain your code a bit better please, but it looks like you need to use timing for your buttons as well as button states to see if they've just been pressed.
I use the while loop and the ButtonPressTime to do everything. As long as the button reads HIGH, the timer will get +1. After a certain amount, it will register it
What are you trying to have your code do?
I am trying to make my Arduino add a text string to a variable per button long press. If the variable is equal to the stored password, it makes the servo open a lock
And you want each button to represent a word?
button 1 = "one"
button 2 = "two"
button 3 = "start"
Is this an assignment? Can you post the original question if there is one?
everything is fixed now
This won't work:
const char PASSWORD="START, ONE, ONE, TWO, TWO";
You need to learn about C-strings (zero terminated character arrays) and how to manipulate them. One place to start would be the many on line references, such as C - Strings
Here is a reference page for all the functions used to manipulate them:
https://www.cplusplus.com/reference/cstring/
If it's just a combo lock then the strings can be done away with completely and an array of numbers used instead.
How do I do an array of numbers? I have never programmed before, so forgive how I don't know anything
Let's start with my previous questions, please.
it is an assignment, but there is no question. What I already told you is everything
Does it say that you have to use strings?
literally nothing, the only reason I used strings is because I have no idea about programming
So you need to make a 3 button combo lock, and no other particulars?
Looks like you are trying to use 5 positions in your combination, is that correct?
Then what is the assignment?
i will explain more in detail:
I got the counter to register a press if it is bigger than a certain number. Two buttons are used to put in the password, the third resets the entered password and locks the door
the assignment is just to make a house automation project. We had to write what project we want to do exactly, and I put the three-button combo lock in. Nothing in particular about the code itself
I am trying to use 5 as an example password