代码拉取完成,页面将自动刷新
// -----
// RotaryEncoder.h - Library for using rotary encoders.
// This class is implemented for use with the Arduino environment.
// Copyright (c) by Matthias Hertel, http://www.mathertel.de
// This work is licensed under a BSD style license. See http://www.mathertel.de/License.aspx
// More information on: http://www.mathertel.de/Arduino
// -----
// 18.01.2014 created by Matthias Hertel
// -----
#ifndef RotaryEncoder_h
#define RotaryEncoder_h
#include "Arduino.h"
#define LATCHSTATE 3
class RotaryEncoder
{
public:
// ----- Constructor -----
RotaryEncoder(int pin1, int pin2);
// retrieve the current position
long getPosition();
// adjust the current position
void setPosition(long newPosition);
// call this function every some milliseconds or by using an interrupt for handling state changes of the rotary encoder.
void tick(void);
private:
uint8_t _pin1, _pin2; // Arduino pins used for the encoder.
uint8_t _oldState;
long _position; // Internal position (4 times _positionExt)
long _positionExt; // External position
};
#endif
// End
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。