<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[no encoder readings..]]></title><description><![CDATA[<p dir="auto">Hi all, I'm trying to work with <a href="https://www.google.com/search?q=incremental+rotary+encoder+600p/r&amp;cad=h" target="_blank" rel="noopener noreferrer nofollow ugc">this</a> incremental rotary encoder connected straight on GROVE port (no resistence), with this sketch:</p>
<pre><code>#include &lt;M5Stack.h&gt;

float  XA_SIG = 0, XB_SIG = 1,  YA_SIG = 0, YB_SIG = 1;
volatile float pulsesX, pulsesY;
void setup() {
  M5.begin();

  pinMode(22, INPUT_PULLUP); // internal pullup input pin
  pinMode(21, INPUT_PULLUP); // internalเป็น pullup input pin

  attachInterrupt(22, XA_RISE, RISING); // Pin 2 stack 22?
  attachInterrupt(21, XB_RISE, RISING); // Pin 3 stack 21?

  Serial.begin(115200);
  delay(100);
  Serial.println("Connected");
}//setup


void loop() {
  Serial.print("x");
  Serial.print(pulsesX);
  Serial.println("end");
  delay(20);
}

//X-Axis

void XA_RISE() {
  detachInterrupt(22);
  //delay(1);
  XA_SIG = 1;

  if (XB_SIG == 0) {

    pulsesX++;//moving forward
  }
  if (XB_SIG == 1) {
    pulsesX--;//moving reverse
  }
  attachInterrupt(22, XA_FALL, FALLING);
}

void XA_FALL() {
  detachInterrupt(22);
  //delay(1);
  XA_SIG = 0;

  if (XB_SIG == 1) {
    pulsesX++;//moving forward
  }
  if (XB_SIG == 0) {
    pulsesX--;//moving reverse
  }
  attachInterrupt(22, XA_RISE, RISING);
}

void XB_RISE() {
  detachInterrupt(21);
  //delay(1);
  XB_SIG = 1;

  if (XA_SIG == 1) {
    pulsesX++;//moving forward
  }
  if (XA_SIG == 0) {
    pulsesX--;//moving reverse
  }
  attachInterrupt(21, XB_FALL, FALLING);
}

void XB_FALL() {
  detachInterrupt(21);
  //delay(1);
  XB_SIG = 0;

  if (XA_SIG == 0) {
    pulsesX++;//moving forwar
  }
  if (XA_SIG == 1) {
    pulsesX--;//moving reverse
  }
  attachInterrupt(21, XB_RISE, RISING);
}

</code></pre>
<p dir="auto">but, when I touch the encoder I have no readings on serial monitor..</p>
<pre><code>
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end
x0.00end


</code></pre>
<p dir="auto">whats wrong??</p>
<p dir="auto">maybe something about IRAM_ATTR ISR() ??</p>
<p dir="auto">tnks</p>
]]></description><link>https://community.m5stack.com/topic/1185/no-encoder-readings</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 03:24:23 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1185.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 Aug 2019 23:20:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to no encoder readings.. on Sat, 12 Oct 2019 10:34:10 GMT]]></title><description><![CDATA[<p dir="auto">nobody??</p>
]]></description><link>https://community.m5stack.com/post/5915</link><guid isPermaLink="true">https://community.m5stack.com/post/5915</guid><dc:creator><![CDATA[cepics]]></dc:creator><pubDate>Sat, 12 Oct 2019 10:34:10 GMT</pubDate></item></channel></rss>