Hey Guys, I was under the impression everything goes on from within the loop() function, but i've seen code where a guy is detecting button presses and rotary encoders and i can't see any relation to the functions he's using inside of loop().
if it possible to detect button presses outside of loop()?
oh ok, im only new at this game so I was under the impression it would only run code in loop() over and over again. is there anything i should be reading that shows me otherwise?
I was under the impression it would only run code in loop() over and over again.
The loop function is called over and over. Don't you see examples, though, where calls to digitalRead(), analogRead(), digitalWrite(), analogWrite(), etc. are called?
You can define functions that you call from loop(). Those functions can call other functions, like digitalRead(), analogRead(), digitalWrite(), analogWrite(), etc., or other functions that you define, that call digitalRead(), analogRead(), digitalWrite(), analogWrite(), etc.
is there anything i should be reading that shows me otherwise?
Anything that progresses beyond the "See Spot Run" level of project.
Without seeing the code, all we're doing here is wasting time guessing. So if you'd like a better answer of how it's done, then you need to show us the actual code you saw, wherever it was or is.
I was under the impression everything goes on from within the loop() function, but i've seen code where a guy is detecting button presses and rotary encoders and i can't see any relation to the functions he's using inside of loop().
yeah ive been calling functions ive make up from outside of loop, but for them to run they need to be referenced back into loop() somehow dont they?
KirAsh4 mention about "interrupts".
Yes, this can be done by "interrupts".