Go Down

Topic: sending sms on function (Read 496 times) previous topic - next topic

PaulS

Quote
how do you pole?

Polling is reading sensors on every pass through loop.

Quote
do I leave the doorState in the void loop. or do I need to put it in a function.

Either one, but that code needs to be in some function.

mark7w

in general terms, I'm even more confused now with what seems to be a wealth of options.

As I understand, If I leave the part of the code in the void loop I need it to call to some piece of code in another function to test a condition. Based on the result of that condition. The part of the void loop  that runs the doorState code will do either something or something else.

It looks kind of simple but I can't code what I am trying to achieve in my head. I have no logic :smiley-red:

Are there really more ways to skin a cat!

PaulS

Quote
Are there really more ways to skin a cat!

Always. There are ways to skin a dog, too. And a deer, and a variety of other animals.

Quote
It looks kind of simple but I can't code what I am trying to achieve in my head. I have no logic

I suspect that is because you are trying to write the whole program at once.

What I like to do is write a whole lot of comments in loop, describing what the whole program is going to do. Then, in between some of the comments, I write some code to perform a specific task. When that works, I write some more code. After a while, loop() is too long, so I move some working code into functions.

Sometimes I get stuck on how to do something, so I create a function that does nothing, and call it in the place I'm stuck. I just have it return a value that makes it seem like it actually did something complex.

Then, I'll go back and make that function do what it is supposed to do, one step at a time. Each time I get stumped, I write a lot of comments.

mark7w

Quote
Always. There are ways to skin a dog, too. And a deer, and a variety of other animals.


Thats Irony ;)

Go Up