Plaquette
 
Loading...
Searching...
No Matches
pq::ServoOut Class Reference

Standard servo-motor (angular). More...

#include <PqServo.h>

Inheritance diagram for pq::ServoOut:
Collaboration diagram for pq::ServoOut:

Public Member Functions

 ServoOut (uint8_t pin, Engine &engine=Engine::primary())
 Constructor for a standard servo-motor.
 
virtual float putAngle (float angle)
 Sets the servomotor position to a specific angle between 0 and 180 degrees.
 
virtual float getAngle ()
 Return the current angular angle in [0, 180].
 
virtual void center ()
 Re-centers the servo-motor.
 
virtual float put (float value)
 Pushes value into the unit.
 
uint8_t pin () const
 Returns the pin this servomotor is attached to.
 
virtual void activate ()
 Activates the servomotor (default).
 
virtual void deactivate ()
 Deactivates the servomotor.
 
virtual bool isActive ()
 Returns true if the servomotor is active.
 
virtual float get ()
 Returns value in [0, 1].
 
virtual float mapTo (float toLow, float toHigh)
 Maps value to new range.
 
virtual void clearEvents ()
 
float seconds () const
 Returns engine time in seconds.
 
uint32_t milliSeconds () const
 Returns engine time in milliseconds.
 
uint64_t microSeconds () const
 Returns engine time in microseconds.
 
unsigned long nSteps () const
 Returns number of engine steps.
 
float sampleRate () const
 Returns engine sample rate.
 
float samplePeriod () const
 Returns enginesample period.
 
 operator float ()
 Object can be used directly to access its value.
 
 operator bool ()
 Operator that allows usage in conditional expressions.
 

Static Public Member Functions

static bool analogToDigital (float f)
 Converts analog (float) value to digital (bool) value.
 
static float digitalToAnalog (bool b)
 Converts digital (bool) value to analog (float) value.
 

Protected Member Functions

virtual void begin ()
 
virtual void step ()
 
virtual bool eventTriggered (EventType eventType)
 Returns true iff an event of a certain type has been triggered.
 
virtual void onEvent (EventCallback callback, EventType eventType)
 Registers event callback.
 
Engineengine () const
 Returns the engine that owns this unit.
 

Protected Attributes

uint8_t _pin
 
float _value
 

Detailed Description

Standard servo-motor (angular).

Constructor & Destructor Documentation

◆ ServoOut()

pq::ServoOut::ServoOut ( uint8_t  pin,
Engine engine = Engine::primary() 
)

Constructor for a standard servo-motor.

Parameters
pinthe pin number

Member Function Documentation

◆ begin()

void pq::AbstractServoOut::begin ( )
protectedvirtualinherited

Reimplemented from pq::Unit.

◆ eventTriggered()

virtual bool pq::Unit::eventTriggered ( EventType  eventType)
inlineprotectedvirtualinherited

Returns true iff an event of a certain type has been triggered.

Reimplemented in pq::AbstractWave, pq::Alarm, pq::Metronome, pq::PeakDetector, pq::DigitalSource, pq::Ramp, pq::StreamIn, and pq::TimeSliceField< COUNT >.

◆ get()

virtual float pq::AnalogSource::get ( )
inlinevirtualinherited

Returns value in [0, 1].

Reimplemented from pq::Chainable.

Reimplemented in pq::AbstractWave.

◆ mapTo()

virtual float pq::AnalogSource::mapTo ( float  toLow,
float  toHigh 
)
inlinevirtualinherited

Maps value to new range.

Reimplemented from pq::Chainable.

Reimplemented in pq::Normalizer, pq::StreamIn, and pq::StreamOut.

◆ put()

float pq::AbstractServoOut::put ( float  value)
virtualinherited

Pushes value into the unit.

Parameters
valuethe value sent to the unit
Returns
the new value of the unit

Reimplemented from pq::Chainable.

◆ putAngle()

float pq::ServoOut::putAngle ( float  angle)
virtual

Sets the servomotor position to a specific angle between 0 and 180 degrees.

Parameters
anglethe angle in degrees
Returns
the current angle

The documentation for this class was generated from the following files: