UNIT-EARTH with a M5Stack Core - Proper Pin?
-
Is the the correct code when using a M5Stack core. I don't get any changes when reading the values? Thanks in advance.
#include <M5Stack.h>
void setup()
{
M5.begin(); // Init M5Stack. 初始化M5Stack
M5.Power.begin(); // Init power 初始化电源模块
M5.lcd.setTextSize(2); // Set the text size to 2. 设置文字大小为2
M5.Lcd.printf("UNIT_EARTH EXAMPLE\n");
pinMode(26, INPUT); // Set pin 26 to input mode. 将引脚26设置为输入模式
dacWrite(25, 0); // disable the speak noise. 禁用喇叭
}void loop()
{
M5.Lcd.setCursor(0, 80); // Set the cursor at (0,80). 将光标设置在(0,80)
M5.Lcd.printf("AnalogRead:%d\n", analogRead(36));
M5.Lcd.printf("DigitalRead:%d\n", digitalRead(26));
delay(1000);
} -
@wwhite Did you plug the UNIT into the red socket on the left side?
These inputs are: 21 and 22.
You could plug it into the discrete I/Os around the base on the right side where you will find 26 and 36. -
@teastain Thank you. It's got a grove connector and I didn't want to cut it.
-
I don't recommend this product. This is what it looks like after being in a barely damp plant overnight! No wonder I couldn't get any readings!

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login