I’m trying to read the PWM signal output from an RC car receiver, but the value displayed in the Serial Monitor remains at 0us. The code is very simple, and it worked perfectly on the Arduino Uno and MEGA. However, I need to switch my development environment to the Arduino R4 Minima, and after making this change, it no longer works.
I’m using the Futaba R3008SB receiver, and I’m trying to read the signal using the R4 Minima. The wiring is simple: I’ve connected the receiver’s channel 1, the Arduino’s GND, and 5V, as well as the signal line directly to the corresponding pins. The program is as follows.
const int pwmPin = 2;
unsigned long pulseWidth;
void setup() {
pinMode(pwmPin, INPUT);
Serial.begin(115200);
}
void loop() {
pulseWidth = pulseIn(pwmPin, HIGH);
Serial.print("Pulse Width: ");
Serial.print(pulseWidth);
Serial.println(" us");
}
I’m not an expert on Arduino, but I have checked the jumper wires and voltage from the receiver, and there’s no issue. The pulseIn
function only fails to work on the R4 Minima. If anyone knows what might be wrong, please let me know.