tino / pyFirmata

Python interface for the Firmata (http://firmata.org/) protocol. It is compliant with Firmata 2.1. Any help with updating to 2.2 is welcome. The Capability Query is implemented, but the Pin State Query feature not yet.
MIT License
573 stars 191 forks source link

Read PWM signal? #91

Open jgoncalocouto opened 4 years ago

jgoncalocouto commented 4 years ago

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"?

myselfgautham commented 3 months ago

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)