Cool that worked.. So is it ok to add multiple "&&" queries when using if controls ? If i had an If control could i add say 4 or 5 "&&" to c reate a really specific question ?
Yes, you can do that. Try reading up on some basic C/C++ syntax, that should solve a lot of your problems before you actually have them.
Also is there a way i can do something for a certain period of time without needing to put millis() into a variable and subtract it again to determine a count ? Is there a way to use SendCode() for 500 milliseconds ?
With the code you have now, you are not executing
SendCode() for 500 milliseconds. It would be more accurate to say that there is a 500 ms
window in which zero, one or multiple calls to
SendCode() can be made.
If you really want to execute some specific command an unknown number of times in the next 500 ms, you should use a loop:
unsigned long start = millis();
while (millis() - start < 500) {
// Code in here is exectuted n times during the next 500 ms (n >= 0)
}
Edit:I am working on a customised controller for a video camera.. I will be using buttons on a joystick to control zoom and other functions but for this bit of code i wanted the zoom to behave more fluently so when the user takes their finger off the button it eases back to a stop over a set amount of milliseconds, rather than just a dead stop..
Ah. In that case, it might be too much trouble to even consider using milliseconds. That's human thinking. Thinking in code, it's much easier and robuster to, say, keep zooming for 100 iterators after a user takes the finger off the button. You could slowly decrease the zoom speed to zero after the button is raised. This is simpeler and better defined than messing around with time intervals.