Hi,
I have a simple code for driving the speed of a motor via a L298N shield and moving a servo motor.
I have the following issue:
- When the code for the servo is commented, analogWrite is producing the expected pulse.
- When the code for the servo is not commented, analogWrite is only setting the pin to HIGH when value is 255. (all other values set the pin to LOW all the time).
#include <Servo.h>
#define PIN_PAN 5
#define PIN_IN1 10
Servo pan;
void setup()
{
pan.attach(PIN_PAN); // analogWrite works as expected when commented
pan.write(90); // analogWrite works as expected when commented
pinMode(PIN_IN1, OUTPUT);
}
void loop()
{
analogWrite(PIN_IN1, 100);
delay(1000);
analogWrite(PIN_IN1, 255);
delay(1000);
}
I've done my verification with a logic analyzer and pulseview pulseview - Album on Imgur
Any idea how to have both the Servo and analogWrite working as expected as the time ?
Thanks,