I have an IRF520 motor driver module that I would want to use with my Seeeduino XIAO. The IRF520 motor driver module has 3 pins : VCC, GND and SIGNAL. The signal pin is normally connected to a PWM pin and it is used to set the motor speed. I wrote the following simple program:
#define MOTOR_PIN 1
void setup() {
pinMode(MOTOR_PIN,OUTPUT);
analogWrite(MOTOR_PIN, 255);
}
void loop() {}
It works on the Arduino Uno, but not on the Seeeduino XIAO. Searching the forums (this thread), I found that Seeeduino has a specific void pwm(uint32_t outputPin, uint32_t frequency, uint32_t duty)
function. I tried replacing analogWrite(MOTOR_PIN, 255)
with this pwm
function (I tried setting different frequencies), but it didn’t work either. How can I make it work?