IR problem,

Hi !
Sorry to disturb you guys, but I didn’t see a post to fix my litle problem.

I would like to control a DC motor with Buttons AND IR transmiter.

My problem is when i send a code with a remote control, my program execute all my conditions 2 or 3 times. and i would like it only once.
I don’t have any problem with my buttons control, only with IR control.

exemple :
Send a IR control to start the DC motor
program: if motor is OFF, turn it ON else turn it OFF

This is a very simple condition, it’s well working with buttons, but with a remote control program will go to the condition 2 or 3 times.

Please guys, help me.

Thanks

my sketch in attached file.

Support TV.ino (1.3 KB)

You are missing a call to irrecv.resume().

You can set results.value to 0 after doing something with the value in that member.