Skip to content

Commit

Permalink
v1.3 for Arduino Library
Browse files Browse the repository at this point in the history
  • Loading branch information
igorantolic committed Oct 3, 2021
1 parent 6921571 commit 82ecd2a
Show file tree
Hide file tree
Showing 22 changed files with 667 additions and 2,323 deletions.
2 changes: 1 addition & 1 deletion .vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"board": "esp32:esp32:esp32",
"port": "COM10"
"port": "COM1"
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Support fot ESP8266 added 10/2021

Support added also for ESP8266

# Changes in button processing 10/2021

Old button using interrupt is now obsolete.
Please look at upadated examples how to handle click, properly initialize encoder and avoid crashing.

# New feature added 02/2021 - accelerated movement

In case a range to select is large, for example - select a value between 0 and 1000 and we want 785, without accelerateion you need long time to get to that number.
Expand All @@ -24,6 +33,14 @@ This library enables easy implementation of rotary encoder functionality in you

## Installing

Since 2021 you can download using Arduino, which is preffered way:

Sketch / include Library / Manage Libraries

in search box type "ai rotary" (without quotes)


Alternative way (to get not yet published version)
The downloaded code can be included as a new library into the IDE selecting the menu:

Sketch / include Library / Add .Zip library
Expand Down
5 changes: 3 additions & 2 deletions examples/Esp32RotaryEncoderBasics/.vscode/arduino.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"board": "esp32:esp32:esp32",
"board": "esp8266:esp8266:d1_mini",
"port": "COM10",
"output": "b:/dummy/Esp32RotaryEncoderBasics",
"sketch": "Esp32RotaryEncoderBasics.ino"
"sketch": "Esp32RotaryEncoderBasics.ino",
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600"
}
481 changes: 98 additions & 383 deletions examples/Esp32RotaryEncoderBasics/.vscode/c_cpp_properties.json

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions examples/Esp32RotaryEncoderBasics/Esp32RotaryEncoderBasics.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ VCC any microcontroler output pin - but set also ROTARY_ENCOD
in this example pin 25
*/
#if defined(ESP8266)
#define ROTARY_ENCODER_A_PIN D6
#define ROTARY_ENCODER_B_PIN D5
#define ROTARY_ENCODER_BUTTON_PIN D7
#else
#define ROTARY_ENCODER_A_PIN 32
#define ROTARY_ENCODER_B_PIN 21
#define ROTARY_ENCODER_BUTTON_PIN 25
#endif
#define ROTARY_ENCODER_VCC_PIN -1 /* 27 put -1 of Rotary encoder Vcc is connected directly to 3,3V; else you can use declared output pin for powering rotary encoder */

//depending on your encoder - try 1,2 or 4 to get expected behaviour
Expand All @@ -39,8 +45,9 @@ void rotary_onButtonClick()
return;
}
lastTimePressed = millis();
Serial.print("button pressed at ");
Serial.println(millis());
Serial.print("button pressed ");
Serial.print(millis());
Serial.println(" milliseconds after restart");
}

void rotary_loop()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"board": "esp32:esp32:esp32",
"board": "esp8266:esp8266:d1_mini",
"port": "COM10",
"output": "b:/dummy/Esp32RotaryEncoderTestAcceleration",
"sketch": "Esp32RotaryEncoderTestAcceleration.ino"
"sketch": "Esp32RotaryEncoderTestAcceleration.ino",
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ VCC any microcontroler output pin - but set also ROTARY_ENCOD
in this example pin 25
*/
#if defined(ESP8266)
#define ROTARY_ENCODER_A_PIN D6
#define ROTARY_ENCODER_B_PIN D5
#define ROTARY_ENCODER_BUTTON_PIN D7
#else
#define ROTARY_ENCODER_A_PIN 32
#define ROTARY_ENCODER_B_PIN 21
#define ROTARY_ENCODER_BUTTON_PIN 25
#endif
#define ROTARY_ENCODER_VCC_PIN -1 /* 27 put -1 of Rotary encoder Vcc is connected directly to 3,3V; else you can use declared output pin for powering rotary encoder */

//depending on your encoder - try 1,2 or 4 to get expected behaviour
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"board": "esp32:esp32:esp32",
"configuration": "PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none",
"board": "esp8266:esp8266:d1_mini",
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600",
"sketch": "Esp32RotaryEncoderTestBoundaries.ino",
"port": "COM10",
"output": "b:/dummy/Esp32RotaryEncoderTestBoundaries"

}
481 changes: 98 additions & 383 deletions examples/Esp32RotaryEncoderTestBoundaries/.vscode/c_cpp_properties.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ VCC any microcontroler output pin - but set also ROTARY_ENCOD
in this example pin 25
*/
#if defined(ESP8266)
#define ROTARY_ENCODER_A_PIN D6
#define ROTARY_ENCODER_B_PIN D5
#define ROTARY_ENCODER_BUTTON_PIN D7
#else
#define ROTARY_ENCODER_A_PIN 32
#define ROTARY_ENCODER_B_PIN 21
#define ROTARY_ENCODER_BUTTON_PIN 25
#endif
#define ROTARY_ENCODER_VCC_PIN -1 /* 27 put -1 of Rotary encoder Vcc is connected directly to 3,3V; else you can use declared output pin for powering rotary encoder */

//depending on your encoder - try 1,2 or 4 to get expected behaviour
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"board": "esp32:esp32:esp32",
"configuration": "PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none",
"board": "esp8266:esp8266:d1_mini",
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600",
"sketch": "Esp32RotaryEncoderTheShortestExample.ino",
"port": "COM10",
"output": "b:/dummy/Esp32RotaryEncoderTheShortestExample"

}
Loading

0 comments on commit 82ecd2a

Please sign in to comment.