<?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[M5GO Motion Sensor, how it work ?]]></title><description><![CDATA[<p dir="auto">Hello, everyone,</p>
<p dir="auto">I have a new M5Stack, the M5Stack GO starter kit. It includes a motion sensor, and I would like to use it. I've read the instructions and connected the motion sensor to the black port, where G26 is for IN/OUT and G36 is for input.</p>
<p dir="auto">When I execute this code:</p>
<pre><code>#include &lt;M5Stack.h&gt;

#define SENSOR_PIN 26
#define RELAY_PIN 36

void setup() {
  pinMode(RELAY_PIN, OUTPUT);
  pinMode(SENSOR_PIN, INPUT);
  Serial.begin(9600);
  M5.begin();
  M5.Lcd.println("I am on");
}

void loop() {
  M5.Lcd.println("Checking for presence");
  int SensorValue = digitalRead(SENSOR_PIN);

  if (SensorValue == HIGH) {
    digitalWrite(RELAY_PIN, LOW);
    M5.Lcd.println("Movement detected");
    delay(500);
  } else {
    digitalWrite(RELAY_PIN, HIGH);
    M5.Lcd.println("No movement");
  }
  delay(1000); // Add a delay in milliseconds (e.g., 1000ms) to control how often you check the sensor.
}
</code></pre>
<p dir="auto">My sensor constantly writes 'no movement.' I think I haven't correctly defined the pin. What can I do to activate my motion sensor and have it write when it detects movement?</p>
<p dir="auto">Thank you for your valuable advice!</p>
]]></description><link>https://community.m5stack.com/topic/5738/m5go-motion-sensor-how-it-work</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 00:10:59 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5738.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Oct 2023 08:23:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5GO Motion Sensor, how it work ? on Tue, 24 Oct 2023 15:12:57 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/recyclosaucisse" aria-label="Profile: Recyclosaucisse">@<bdi>Recyclosaucisse</bdi></a></p>
<p dir="auto">you already described it correctly: G26 can be IN or OUT; G36 is IN only.</p>
<p dir="auto">Your defines need to be swapped: <code>SENSOR_PIN 36</code> and <code>RELAY_PIN 26</code>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/22570</link><guid isPermaLink="true">https://community.m5stack.com/post/22570</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 24 Oct 2023 15:12:57 GMT</pubDate></item></channel></rss>