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.