Skip to content

Commit 82ecd2a

Browse files
committed
v1.3 for Arduino Library
1 parent 6921571 commit 82ecd2a

File tree

22 files changed

+667
-2323
lines changed

22 files changed

+667
-2323
lines changed

.vscode/arduino.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"board": "esp32:esp32:esp32",
3-
"port": "COM10"
3+
"port": "COM1"
44
}

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Support fot ESP8266 added 10/2021
2+
3+
Support added also for ESP8266
4+
5+
# Changes in button processing 10/2021
6+
7+
Old button using interrupt is now obsolete.
8+
Please look at upadated examples how to handle click, properly initialize encoder and avoid crashing.
9+
110
# New feature added 02/2021 - accelerated movement
211

312
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.
@@ -24,6 +33,14 @@ This library enables easy implementation of rotary encoder functionality in you
2433

2534
## Installing
2635

36+
Since 2021 you can download using Arduino, which is preffered way:
37+
38+
Sketch / include Library / Manage Libraries
39+
40+
in search box type "ai rotary" (without quotes)
41+
42+
43+
Alternative way (to get not yet published version)
2744
The downloaded code can be included as a new library into the IDE selecting the menu:
2845

2946
Sketch / include Library / Add .Zip library
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"board": "esp32:esp32:esp32",
2+
"board": "esp8266:esp8266:d1_mini",
33
"port": "COM10",
44
"output": "b:/dummy/Esp32RotaryEncoderBasics",
5-
"sketch": "Esp32RotaryEncoderBasics.ino"
5+
"sketch": "Esp32RotaryEncoderBasics.ino",
6+
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600"
67
}

examples/Esp32RotaryEncoderBasics/.vscode/c_cpp_properties.json

Lines changed: 98 additions & 383 deletions
Large diffs are not rendered by default.

examples/Esp32RotaryEncoderBasics/Esp32RotaryEncoderBasics.ino

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ VCC any microcontroler output pin - but set also ROTARY_ENCOD
1717
in this example pin 25
1818
1919
*/
20+
#if defined(ESP8266)
21+
#define ROTARY_ENCODER_A_PIN D6
22+
#define ROTARY_ENCODER_B_PIN D5
23+
#define ROTARY_ENCODER_BUTTON_PIN D7
24+
#else
2025
#define ROTARY_ENCODER_A_PIN 32
2126
#define ROTARY_ENCODER_B_PIN 21
2227
#define ROTARY_ENCODER_BUTTON_PIN 25
28+
#endif
2329
#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 */
2430

2531
//depending on your encoder - try 1,2 or 4 to get expected behaviour
@@ -39,8 +45,9 @@ void rotary_onButtonClick()
3945
return;
4046
}
4147
lastTimePressed = millis();
42-
Serial.print("button pressed at ");
43-
Serial.println(millis());
48+
Serial.print("button pressed ");
49+
Serial.print(millis());
50+
Serial.println(" milliseconds after restart");
4451
}
4552

4653
void rotary_loop()
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"board": "esp32:esp32:esp32",
2+
"board": "esp8266:esp8266:d1_mini",
33
"port": "COM10",
44
"output": "b:/dummy/Esp32RotaryEncoderTestAcceleration",
5-
"sketch": "Esp32RotaryEncoderTestAcceleration.ino"
5+
"sketch": "Esp32RotaryEncoderTestAcceleration.ino",
6+
"configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600"
67
}

examples/Esp32RotaryEncoderTestAcceleration/.vscode/c_cpp_properties.json

Lines changed: 98 additions & 383 deletions
Large diffs are not rendered by default.

examples/Esp32RotaryEncoderTestAcceleration/Esp32RotaryEncoderTestAcceleration.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ VCC any microcontroler output pin - but set also ROTARY_ENCOD
1717
in this example pin 25
1818
1919
*/
20+
#if defined(ESP8266)
21+
#define ROTARY_ENCODER_A_PIN D6
22+
#define ROTARY_ENCODER_B_PIN D5
23+
#define ROTARY_ENCODER_BUTTON_PIN D7
24+
#else
2025
#define ROTARY_ENCODER_A_PIN 32
2126
#define ROTARY_ENCODER_B_PIN 21
2227
#define ROTARY_ENCODER_BUTTON_PIN 25
28+
#endif
2329
#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 */
2430

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

examples/Esp32RotaryEncoderTestBoundaries/.vscode/c_cpp_properties.json

Lines changed: 98 additions & 383 deletions
Large diffs are not rendered by default.

examples/Esp32RotaryEncoderTestBoundaries/Esp32RotaryEncoderTestBoundaries.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ VCC any microcontroler output pin - but set also ROTARY_ENCOD
1717
in this example pin 25
1818
1919
*/
20+
#if defined(ESP8266)
21+
#define ROTARY_ENCODER_A_PIN D6
22+
#define ROTARY_ENCODER_B_PIN D5
23+
#define ROTARY_ENCODER_BUTTON_PIN D7
24+
#else
2025
#define ROTARY_ENCODER_A_PIN 32
2126
#define ROTARY_ENCODER_B_PIN 21
2227
#define ROTARY_ENCODER_BUTTON_PIN 25
28+
#endif
2329
#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 */
2430

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

0 commit comments

Comments
 (0)