-
Notifications
You must be signed in to change notification settings - Fork 0
A3144HallSensor
Alex Krieg edited this page Sep 27, 2020
·
5 revisions
- A3144(byte pin,bool activeHigh = false);
- ~A3144();
- void OnChange(void (*p_func)(bool));
- void OnTriggerHigh(void (*p_func)());
- void OnTriggerLow(void (*p_func)());
- void OnHigh(void (*p_func)());
- void ticksPerRevolution(unsigned int ticks);
- void update();
- unsigned long counts();
- float rpm();
- bool state();
- void reset();
- Constructor
- Needs the pin on which the sensor is connected to.
- Needs a definition, if the sensor pulls the voltage down when it is actuated.
- Standard for the A3144 is false.
A3144 myHallSensor(2);
A3144 myHallSensor(2,true);
HallSensor myHallSensor(2);
HallSensor myHallSensor(2,true);
- Destrucktor
delete &myHallSensor;
You do not know how events work?
Look over here
- Is executed when the state of the sensor has changed.
- ONE value accepted. Gives the state of the sensor.
- NO return values.
- Is executed when the state of the sensor is rising.
- NO value accepted.
- NO return values.
- Is executed when the state of the sensor is falling.
- NO value accepted.
- NO return values.
- Is executed when the sensor is actuated.
- NO value accepted.
- NO return values.
- Defines how many ticks or activations of the sensor it needs per revolution on a shaft.
- Useful for encoders on motors.
myHallSensor.ticksPerRevolution(100);
- Checks the state of the sensor.
- Triggers the events.
myHallSensor.update();
- Returns the amount of activations of the sensor.
unsigned int counts = myHallSensor.counts();
- Returns the rpm (revolution per minute).
- Useful for encoders on motors.
float rpm = myHallSensor.rpm();
- Returns the state of the sensor.
bool state = myHallSensor.state();
- Resets some variables such as counts.
myHallSensor.reset();
Wiki
Arduino libraries