SimpleFOClibrary  2.1
MagneticSensorAnalog Class Reference

#include <MagneticSensorAnalog.h>

Inheritance diagram for MagneticSensorAnalog:
Sensor

Public Member Functions

 MagneticSensorAnalog (uint8_t _pinAnalog, int _min=0, int _max=0)
 
void init ()
 
float getAngle () override
 
float getVelocity () override
 
- Public Member Functions inherited from Sensor
virtual int needsSearch ()
 

Public Attributes

int pinAnalog
 encoder hardware pin A More...
 
Pullup pullup
 

Detailed Description

This sensor has been tested with AS5600 running in 'analog mode'. This is where output pin of AS6000 is connected to an analog pin on your microcontroller. This approach is very simple but you may more accurate results with MagneticSensorI2C if that is also supported as its skips the DAC -> ADC conversion (ADC supports MagneticSensorI2C)

Definition at line 13 of file MagneticSensorAnalog.h.

Constructor & Destructor Documentation

◆ MagneticSensorAnalog()

MagneticSensorAnalog::MagneticSensorAnalog ( uint8_t  _pinAnalog,
int  _min_raw_count = 0,
int  _max_raw_count = 0 
)

MagneticSensorAnalog class constructor

Parameters
_pinAnalogthe pin to read the PWM signal

MagneticSensorAnalog(uint8_t _pinAnalog, int _min, int _max)

Parameters
_pinAnalogthe pin that is reading the pwm from magnetic sensor
_min_raw_countthe smallest expected reading. Whilst you might expect it to be 0 it is often ~15. Getting this wrong results in a small click once per revolution
_max_raw_countthe largest value read. whilst you might expect it to be 2^10 = 1023 it is often ~ 1020. Note: For ESP32 (with 12bit ADC the value will be nearer 4096)

Definition at line 8 of file MagneticSensorAnalog.cpp.

Member Function Documentation

◆ getAngle()

float MagneticSensorAnalog::getAngle ( )
overridevirtual

get current angle (rad)

Implements Sensor.

Definition at line 38 of file MagneticSensorAnalog.cpp.

◆ getVelocity()

float MagneticSensorAnalog::getVelocity ( )
overridevirtual

get current angular velocity (rad/s)

Reimplemented from Sensor.

Definition at line 64 of file MagneticSensorAnalog.cpp.

◆ init()

void MagneticSensorAnalog::init ( )

sensor initialise pins

Definition at line 25 of file MagneticSensorAnalog.cpp.

Member Data Documentation

◆ pinAnalog

int MagneticSensorAnalog::pinAnalog

encoder hardware pin A

Definition at line 25 of file MagneticSensorAnalog.h.

◆ pullup

Pullup MagneticSensorAnalog::pullup

Definition at line 28 of file MagneticSensorAnalog.h.


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