magneto4 2.0.0.0
|
Magneto 4 click is a high-resolution magnetic encoder Click board™ which allows contactless motion sensing down to 0.5µm.
We provide a library for the Magneto4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.
This library contains API for Magneto4 Click driver.
- Initialization function.void magneto4_cfg_setup ( magneto4_cfg_t *cfg );
MAGNETO4_RETVAL magneto4_init ( magneto4_t *ctx, magneto4_cfg_t *cfg );
void magneto4_default_cfg ( magneto4_t *ctx );
- Encoder positionuint8_t magneto4_get_magnetic_status ( magneto4_t *ctx, mag_status_t *mag_status );
void magneto4_get_encoder_position ( magneto4_t *ctx );
uint8_t magneto4_get_encoder_direction ( magneto4_t *ctx, mag_status_t *mag_status );
Reads and logs magnetic field strength values if magnetic field strength values bigger than 3000, start magnetic linear position mode,
when moving the sensor from left to right the position for 1 step is reduced.
The demo application is composed of two sections :
Initializes Driver init and sets start encoder position on the zero. Reads and logs magnetic field strength values. For starting an encoder, it is necessary that the magnetic field strength is greater than 3000.
When moving the sensor from left to right, one step is added and when moving from right to left, the position for 1 step is reduced.
The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.
Other mikroE Libraries used in the example:
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.