Skip to main content

Using the Cypher Max

The Cypher Max uses the DutyCycleEncoder class from WPILib for absolute reading. View WPILib docs for up to date information. For quadrature reading use the normal Encoder class. WPILib Encoder

Example code​

tip

The Cypher Max Absolute angle increases in the Clockwise direction. The quadrature count increases in the Counter-Clockwise direction.

info

The Cypher Max supports simultaneous use of the Absolute and Quadrature outputs.

Absolute Encoder​

import edu.wpi.first.wpilibj.DutyCycleEncoder;

// Using DIO Port 0
DutyCycleEncoder cypherMax = new DutyCycleEncoder(0);

// Get Absolute Angle
SmartDashboard.putNumber("CypherMax", (cypherMax.Get() * 360.0) % 360.0);

Quadrature Encoder​

import edu.wpi.first.wpilibj.Encoder;

// Using DIO port 0 (A) and 1 (B)
Encoder cypher = new Encoder(0, 1, false, EncodingType.k4X);

// Get Raw Count
SmartDashboard.putNumber("Cypher", cypher.getRaw());