wpi-32u4-library
Public Member Functions
Servo32U4Pin6 Class Reference

A servo class to control a servo on pin 6. More...

#include <servo32u4.h>

Inherits Servo32U4Base.

Public Member Functions

void attach (void)
 
void detach (void)
 
void writeMicroseconds (uint16_t microseconds)
 
- Public Member Functions inherited from Servo32U4Base
virtual void attach (void)=0
 
virtual void detach (void)=0
 
virtual void writeMicroseconds (uint16_t microseconds)=0
 
uint16_t setMinMaxMicroseconds (uint16_t min, uint16_t max)
 

Additional Inherited Members

- Protected Attributes inherited from Servo32U4Base
uint16_t usMin = 1000
 
uint16_t usMax = 2000
 
uint8_t feedbackPin = -1
 
bool isAttached = false
 

Detailed Description

A servo class to control a servo on pin 6.

Servo32U4Pin6 uses output compare on Timer4 to control the pulse to the servo. _In Chassis::init(), The 8-bit Timer4 is set up with a pre-scaler of 1024, TOP of 249 + 1 => 16 ms interval.

YOU MUST CALL Chasssis::init() IN setup() FOR THIS TO WORK, AND YOU MUST CALL Chassis::init() BEFORE YOU CALL attach()

OCR4D controls the pulse on pin 6 – this servo must be on pin 6!

Note that pin 6 controls the buzzer, so you'll go crazy if you don't cut the buzzer trace. See: https://www.pololu.com/docs/0J69/3.2 for how to cut the trace.

Defaults to a range of 1000 - 2000 us, but can be customized.

Note that because we're using an 8-bit timer, resolution is only 64 us.

Definition at line 94 of file servo32u4.h.

Member Function Documentation

◆ attach()

void Servo32U4Pin6::attach ( void  )
virtual

Implements Servo32U4Base.

Definition at line 55 of file servo32u4.cpp.

References Servo32U4Base::isAttached.

Referenced by handleKeyPress(), setup(), and writeMicroseconds().

◆ detach()

void Servo32U4Pin6::detach ( void  )
virtual

Implements Servo32U4Base.

Definition at line 69 of file servo32u4.cpp.

References Servo32U4Base::isAttached.

Referenced by idle().

◆ writeMicroseconds()

void Servo32U4Pin6::writeMicroseconds ( uint16_t  microseconds)
virtual

Implements Servo32U4Base.

Definition at line 82 of file servo32u4.cpp.

References attach(), Servo32U4Base::isAttached, Servo32U4Base::usMax, and Servo32U4Base::usMin.

Referenced by adjustServos().


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