Skip to content
Snippets Groups Projects
Select Git revision
  • f49b61a19c79372ee6fc9ff02d1360db2861adae
  • master default protected
  • ecg-ledupdate
  • ecg-app-pause
  • ecg-app
  • remove-debug-bhi160
  • docs-power
  • clock-colors
  • ble-text-color
  • menu-timeout
  • update-menu
  • rahix/batt
  • genofire/ble-rewrite
  • renze/safe_mode
  • renze/hatchery_apps
  • schneider/fundamental-test
  • koalo/factory-reset
  • ios-workarounds
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
26 results

build_image.sh

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    pyb.Servo.rst 2.67 KiB

    class Servo -- 3-wire hobby servo driver

    Servo objects control standard hobby servo motors with 3-wires (ground, power, signal). There are 4 positions on the pyboard where these motors can be plugged in: pins X1 through X4 are the signal pins, and next to them are 4 sets of power and ground pins.

    Example usage:

    import pyb
    
    s1 = pyb.Servo(1)   # create a servo object on position X1
    s2 = pyb.Servo(2)   # create a servo object on position X2
    
    s1.angle(45)        # move servo 1 to 45 degrees
    s2.angle(0)         # move servo 2 to 0 degrees
    
    # move servo1 and servo2 synchronously, taking 1500ms
    s1.angle(-60, 1500)
    s2.angle(30, 1500)

    Note

    The Servo objects use Timer(5) to produce the PWM output. You can use Timer(5) for Servo control, or your own purposes, but not both at the same time.

    Constructors

    Create a servo object. id is 1-4, and corresponds to pins X1 through X4.

    Methods