zephyr/samples/basic/servo_motor
Henrik Brix Andersen db611e6781 drivers: pwm: add support for inverted PWM signals
Add support for requesting an inverted PWM pulse (active-low) when
setting up the period and pulse width of a PWM pin. This is useful
when driving external, active-low circuitry (e.g. an LED) with a PWM
signal.

All in-tree PWM drivers is updated to match the new API signature, but
no driver support for inverted PWM signals is added yet.

All in-tree PWM consumers are updated to pass a flags value of 0
(0 meaning default, which is normal PWM polarity).

Fixes #21384.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-01-07 18:13:18 +01:00
..
src drivers: pwm: add support for inverted PWM signals 2020-01-07 18:13:18 +01:00
CMakeLists.txt
README.rst samples: servo_motor: remove whitelisting 2019-07-12 05:54:16 -07:00
bbc_microbit.overlay
prj.conf
sample.yaml tests: fix test identifiers 2019-12-09 15:53:44 -05:00

README.rst

.. _servo-motor-sample:

PWM: Servo motor
################

Overview
********

This is a sample app which drives a servo motor using PWM.

This app is targeted for servo motor ROB-09065. With the PWM control signal, the
servo motor can rotate to any angle between 0 and 180 degrees. The corresponding
PWM pulse width is between 700 micro seconds and 2300 micro seconds. The motor
is programmed to rotate back and forth in the 180 degree range.

Since different servo motors may require different PWM pulse width, you may need
to modify the pulse width in the app if you are using a different servo motor.

Wiring
******

BBC micro:bit
=============

You will need to connect the motor's red wire to external 5V, the black wire to
ground and the white wire to pad 0 on the edge connector.

Building and Running
********************

This sample can be built for multiple boards, in this example we will build it
for the bbc_microbit board:

.. zephyr-app-commands::
   :zephyr-app: samples/basic/servo_motor
   :board: bbc_microbit
   :goals: build flash
   :compact: