Infrared IR & PWM issue

Infrared IR & PWM issue

Hi everyone, I seem to have an issue where the PWM value is not being passed onto the motor, not sure why this should be the case.

The Arduino is connected to a Cytron MD10c. to drive a motor connected to a 12 volt supply.

This is a part of the sketch, the area where I am amending the PWM variables.

if (irrecv.decode(&results))

case 0xFF906F: // (" Up ");
Serial.println(" Up ");

analogWrite(pinPwm, 100);

digitalWrite(pinPwm, HIGH);

digitalWrite(pinDir, HIGH);

Thanks in advance for any assistance.

Which timer does the IR library use?
What is the value of pinPwm?

Why the digitalWrite after the analogWrite?

Why not full code?
Why no code tags?

Why do you think this is an installation issue?

Which timer does the IR library use? #include <IRremote.h>
What is the value of pinPwm? 100

Why the digitalWrite after the analogWrite? Motor does not work without that line

Why not full code? Keep the post brief
Why no code tags? What do you mean?

Why do you think this is an installation issue? The motor fails to respond correctly once I decided to add a IR switch.

Which timer does the IR library use? #include <IRremote.h>

Not the answer I was looking for

What is the value of pinPwm? 100

Wrong.

Why not full code? Keep the post brief

Also wrong. Very wrong.

Why do you think this is an installation issue? The motor fails to respond correctly once I decided to add a IR switch.

So, it went from being “working” to “installation issue” ?

Why the digitalWrite after the analogWrite? Motor does not work without that line

You may as well have simply written analogWrite(pinPwm, 255); (And that was a hint about code tags too)

Being condescending is an unintelligent way to make yourself feel superior.

Posting snippets of code that haven’t a hope of compiling, and missing out vital information is an unintelligent way of trying to gain help for free.

Good luck with that approach - you’ll be needing it.

The IR library uses one of the processor (CPU of your mystery Arduion) built in timers. PWM uses one of the processors built in timers. Both processes cannot use the same timer.

He asked about the value of the pinPwm variable which is the pin number assigned to pinPwm. Which timer is that PWM pin using? Since you did not post your whole code I do not know which library you are using for IR so do not know which timer is being used by that library nor do I know what processor you have.
For a mega328 based board:

- Pins 5 and 6: controlled by Timer 0
- Pins 9 and 10: controlled by timer 1
- Pins 11 and 3: controlled by timer 2

Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.