We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-03-13
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 5071 times
Not followed.
License: MIT license
Opto Encoder click is a linear incremental optical sensor/encoder click, which can be used for the movement or rotation encoding. Encoders of this type are widely used for many applications, which involve precise detection of the position, speed, or rotational angle of an object.
Do you want to subscribe in order to receive notifications regarding "Opto Encoder click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Opto Encoder click" changes.
Do you want to report abuse regarding "Opto Encoder click".
Library Description
This library contains basic functions that will allow you to read the sensor.
Key functions:
void optoencoder_init() - Initialization for the click board.
uint8_t optoencoder_getO1() - Read the state of encoder channel 1.
uint8_t optoencoder_getO2() - Read the state of the encoder channel 2.
int16_t optoencoder_getPosition() - Return's the current position.
Examples Description
void applicationTask() { newStep = optoencoder_getPosition(); if(oldStep != newStep) { IntToStr(newStep, text); mikrobus_logWrite(" Step: ", _LOG_TEXT); mikrobus_logWrite(text, _LOG_LINE); oldStep = newStep; } }
Other mikroE Libraries used in the example:
Additional notes and information
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.