Dezibot 4
Motor Class Reference

#include <Motion.h>

Public Member Functions

 Motor (uint8_t pin, ledc_timer_t timer, ledc_channel_t channel)
 
void begin (void)
 Initializes the motor. More...
 
void setSpeed (uint16_t duty)
 Set the Speed by changing the pwm. To avoid current peaks, a linear ramp-up is used. More...
 
uint16_t getSpeed (void)
 returns the currently activ speed More...
 

Protected Attributes

uint8_t pin
 
ledc_timer_t timer
 
ledc_channel_t channel
 
uint16_t duty
 

Detailed Description

Definition at line 27 of file Motion.h.

Constructor & Destructor Documentation

◆ Motor()

Motor::Motor ( uint8_t  pin,
ledc_timer_t  timer,
ledc_channel_t  channel 
)

Definition at line 3 of file Motor.cpp.

Member Function Documentation

◆ begin()

void Motor::begin ( void  )

Initializes the motor.

Definition at line 10 of file Motor.cpp.

+ Here is the caller graph for this function:

◆ getSpeed()

uint16_t Motor::getSpeed ( void  )

returns the currently activ speed

Returns
current speedvalue of the motor

Definition at line 46 of file Motor.cpp.

+ Here is the caller graph for this function:

◆ setSpeed()

void Motor::setSpeed ( uint16_t  duty)

Set the Speed by changing the pwm. To avoid current peaks, a linear ramp-up is used.

Attention
it is requried at any time to use that method to access the motors or methods of the motionclass to avoid such peaks.
Parameters
dutythe duty cyle that should be set, can be between 0-8192

Definition at line 25 of file Motor.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ channel

ledc_channel_t Motor::channel
protected

Definition at line 54 of file Motion.h.

◆ duty

uint16_t Motor::duty
protected

Definition at line 56 of file Motion.h.

◆ pin

uint8_t Motor::pin
protected

Definition at line 52 of file Motion.h.

◆ timer

ledc_timer_t Motor::timer
protected

Definition at line 53 of file Motion.h.


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