hArduino-0.6: Control your Arduino board from Haskell.

Stabilityexperimental
Maintainererkokl@gmail.com
Safe HaskellNone

System.Hardware.Arduino.Parts.Servo

Contents

Description

Abstractions for servo motors. See System.Hardware.Arduino.SamplePrograms.Servo for example uses.

Synopsis

Attaching a servo motor on a pin

data Servo Source

A servo motor. Note that this type is abstract, use attach to create an instance.

attachSource

Arguments

:: Pin

Pin controlling the servo. Should be a pin that supports SERVO mode.

-> Maybe Int

Pulse-width (in microseconds) for the minumum 0-degree angle. Default: 544.

-> Maybe Int

Pulse-width (in microseconds) for the maximum, typically 180-degree, angle. Default: 2400.

-> Arduino Servo 

Create a servo motor instance. The default values for the min/max angle pulse-widths, while typical, may need to be adjusted based on the specs of the actual servo motor. Check the data-sheet for your servo to find the proper values. The default values of 544 and 2400 microseconds are typical, so you might want to start by passing Nothing for both parameters and adjusting as necessary.

Setting servo position

setAngle :: Servo -> Int -> Arduino ()Source

Set the angle of the servo. The argument should be a number between 0 and 180, indicating the desired angle setting in degrees.