Testing IRremote Using Arduino Uno

HELLO this post will post to another topic. Sorry

There's nothing in your code to make it continuous. When you press zero, it moves from 50-13 and back once. Then it goes back to look for another signal from the remote.

I'm amazed that the servo does anything with the code you posted, You never attach() it to a pin.

Steve

how to make it continuously moving if press "zero"

sorry it was not copied before. i was put it inside the code above

Your code doesn't compile. Can you post a fresh version that does - in a new post, don't edit the old one.

What you could do as a first try is to change the zero code to simply flip a global boolean variable. At the end of loop, if the variable is true, run the servo code you have to move out and back once.

The problem with this is that it will likely make the system unresponsive as it will be spending all its time sending servo commands or running delay and you'll need to be lucky to get a remote signal noticed.

1 Like

sorry i do not understand what you mean here. please give a sample code here. thanks

MybooleanVar = !MybooleanVar;

where i put that? before void setup()

No, in the case for zero as mentioned above.

couldn't compile. 'MybooleanVar' was not declared in this scope

It feels like you are trying to code without coding, which is very Zen, but not very effective. I suggest that you spend some time working through the first few chapters of a C++ tutorial - it'll help immensely. Once you get past functions and arrays, that'll probably be sufficient for now.

1 Like