pyFirmata icon indicating copy to clipboard operation
pyFirmata copied to clipboard

Read PWM signal?

Open jgoncalocouto opened this issue 4 years ago • 1 comments

Hello,

I'm very green on arduino, I just know the very basics. Because python is more easy for me I started using pyfirmata to control arduino.

Having that said, it can be my incompetence, but I've search everywhere and couldn't find an answer. I would like to measure frequency with the arduino, in order to get feedback of the rotational speed from a fan. I'm just clueless on how to do it with pyfirmata. I thought it could be done by setting a digital pin to pwm mode and then perform a read operation but it doesn't work. Also, I tried to just read digital input with very small time steps and then calculate the duty cycle over a larger period of time by counting the ones and the zeros, but also no good results.

Is there a way to do this with pyfirmata or should I just learn the "arduino language"?

jgoncalocouto avatar Mar 27 '20 19:03 jgoncalocouto

Bro You Cant Read A PWM Signal But There Is A Similar Thing To It Called Analog Signals Analog Signal Have 6 Pins I Believe On The Arduino (A0 A1 A2 ETC)

  • Connect The Signal To One Of The Analog Ports
  • Change PINDEF To a For Analog Or Use board.analog[*].enable_reporting()
  • Then Read The Input

myselfgautham avatar Apr 14 '24 14:04 myselfgautham