Struct rust_gpiozero::output_devices::Servo[][src]

pub struct Servo { /* fields omitted */ }

Represents a PWM-controlled servo motor connected to a GPIO pin.

Implementations

impl Servo[src]

pub fn new(pin: u8) -> Servo[src]

Returns a Servo with the pin number given with default min_pulse_width of 1ms, max_pulse_width of 2ms and frame_width of 20ms

  • pin - The GPIO pin which the device is attached to

pub fn min(&mut self)[src]

Set the servo to its minimum position.

pub fn max(&mut self)[src]

Set the servo to its maximum position.

pub fn mid(&mut self)[src]

Set the servo to its neutral position.

pub fn set_min_pulse_width(&mut self, value: u64)[src]

Set the servo’s minimum pulse width

pub fn set_max_pulse_width(&mut self, value: u64)[src]

Set the servo’s maximum pulse width

pub fn set_frame_width(&mut self, value: u64)[src]

Set the servo’s frame width(The time between control pulses, measured in milliseconds.)

pub fn get_min_pulse_width(&mut self) -> u64[src]

Get the servo’s minimum pulse width

pub fn get_max_pulse_width(&mut self) -> u64[src]

Get the servo’s maximum pulse width

pub fn get_frame_width(&mut self) -> u64[src]

Get the servo’s frame width(The time between control pulses, measured in milliseconds.)

Auto Trait Implementations

impl !RefUnwindSafe for Servo

impl Send for Servo

impl Sync for Servo

impl Unpin for Servo

impl !UnwindSafe for Servo

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.