![](/media/cache/group/Display_Nokia_Insper_v01.jpg.50x50_q85.jpg)
Leitura de pulsos KY-040
Dependencies: mbed EncoderAli
main.cpp
- Committer:
- henriquer
- Date:
- 2022-04-19
- Revision:
- 1:0e176288c7ca
- Parent:
- 0:862c19aa5239
File content as of revision 1:0e176288c7ca:
//***********************Encoder/Decoder KY-040*******************************// #include "mbed.h" #include "Encoder.h" // Biblioteca responsável pela leitura dos pulsos //****************************************************************************// //****************************************************************************// //****************************************************************************// int pulse; // Variável responsável atribuída para leitura dos pulsos //****************************************************************************// //****************************************************************************// int main() { EncoderAli Enc(PB_13,PB_14,PB_15); // Ligação do KY-040 nos pinos da Nucleo - DT, CLK, SW Enc.setRange(1,20); // Função responsável por setar o Range do Encoder while(1) { printf("\n\r PULSOS: %d; ",Enc.getState()); // ,Enc.getState() -> Função Responsável por ler os pulsos ,Enc.getButtonState()-> Função responsável por ler o estado do botão SW pulse = Enc.getState(); } } //****************************************************************************//