Reading PWM signal from a receiver
bulkhead
Posts: 405
I would like to interface a 6ch airplane radio with my javelin for a radio control robot. Has anyone done this before? Is there a VP that takes care of this, or do I need to read it in my main loop?
Comments
So you are required to do it manually in your mainloop.
regards peter
pwm signal o
+
o countPin
······· ··········· |
··········· ······ [noparse][[/noparse]R1]
··············· ··· |·········· +
o ADC inPin
·················Ua·+----[noparse][[/noparse]R]----+----[noparse][[/noparse]R]---o ADC outPin
················· · |·········· |
················· ·[noparse][[/noparse]C1]········[noparse][[/noparse]C]
················· · |·········· |
················ ··GND········ GND
The ADC vp measures the average voltage Ua that represents the pwm dutycycle
The count() measures the number of pulses in a given timeperiod (eg. 100msec or so)
From both you can calculate the duration of low and high period of the pwm signal.
Or use two pulseIn() commands, the first measures a high pulse, the second a low pulse.
You must assume then that adjacent pulses do not change, or at least not rapidly.
regards peter
I placed it in the folder lib/stamp/core
regards peter