I am trying to connecting rotary incremental encoder with NodeMCU Lua V3, ESP8266, CH340G.

This tutorial is what I want to do https://www.youtube.com/watch?v=Y6BjnfwfzKE but here is the warning

Abort called


ctx: cont
sp: 3ffffdb0 end: 3fffffc0 offset: 01b0
3fffff60:  feefeffe 00000001 3ffee24c 3ffee2a4  
3fffff70:  3fffdad0 00000001 3ffee24c 3ffee2a4  
3fffff80:  3fffdad0 40201028 3ffe84cc 40100452  
3fffff90:  feefeffe 3ffe84d0 3ffe84cc 40201132  
3fffffa0:  feefeffe 00000000 3ffee274 40201954  
3fffffb0:  feefeffe feefeffe 3ffe84fc 4010073d  
H⸮⸮ԅ⸮⸮D⸮N⸮ISR not in IRAM!


int encoderPin1 = 10;
int encoderPin2 = 9;

volatile int lastEncoded = 0;
volatile long encoderValue = 0;

long lastencoderValue = 0;

int lastMSB = 0;
int lastLSB = 0;

void setup() {
  Serial.begin (9600);

  pinMode(encoderPin1, INPUT_PULLUP);
  pinMode(encoderPin2, INPUT_PULLUP);

  digitalWrite(encoderPin1, HIGH); //turn pullup resistor on
  digitalWrite(encoderPin2, HIGH); //turn pullup resistor on

  //call updateEncoder() when any high/low changed seen
  //on interrupt 0 (pin 2), or interrupt 1 (pin 3)
  attachInterrupt(0, updateEncoder, CHANGE);
  attachInterrupt(1, updateEncoder, CHANGE);


void loop() {
  //Do stuff here

  //delay(1000); //just here to slow down the output, and show it will work  even during a delay

void updateEncoder() {
  int MSB = digitalRead(encoderPin1); //MSB = most significant bit
  int LSB = digitalRead(encoderPin2); //LSB = least significant bit

  int encoded = (MSB << 1) | LSB; //converting the 2 pin value to single number
  int sum  = (lastEncoded << 2) | encoded; //adding it to the previous encoded value

  if (sum == 0b1101 || sum == 0b0100 || sum == 0b0010 || sum == 0b1011) encoderValue ++;
  if (sum == 0b1110 || sum == 0b0111 || sum == 0b0001 || sum == 0b1000) encoderValue --;

  lastEncoded = encoded; //store this value for next time

enter image description here

GTS06--->ESP8266 Boards(2.5.2) Gereric ESP8266 Module





How can I solve this?

  • What version of the ESP8266 core are you using? – Majenko Sep 19 at 10:00
  • Ver 0.1. ISM 2.4Ghz. PA +25dBm. 802.11b/g/n – AllenBooTung Sep 19 at 10:08
  • Pardon? What version of the ESP8266 CORE are you using? Look in the IDE to see what you installed. – Majenko Sep 19 at 10:09
  • ESP8266 Boards(2.5.2) – AllenBooTung Sep 19 at 10:20
  • Ok, that's the latest release version. It is a known error, and I thought they'd fixed it. There's plenty of discussion about it on github, including pull requests. Maybe you need the Github version to fix it properly... Ah well, add ICACHE_RAM_ATTR in front of your ISR. – Majenko Sep 19 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.