Code dose not want to loop in a loop
Go to solution
Solved by shadow_ray,
This is how your code looks like:
void loop(){ //no code here if (IrReceiver.decode()) { //bunch of code here } //no code here }
Let's see what bool IRrecv::decode() does:
The main decode function, attempts to decode the recently receive IR signal.
@return false if no IR receiver data available, true if data available. Results of decoding are stored in IrReceiver.decodedIRData.
You should brake it up into 2 parts:
data_type data; void loop(){ if (IrReceiver.decode()) { //process the recieved data here data = process_data(IrReceiver.decodedIRData); } //do usual stuff here do_stuff(); }
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now