#include <M5StickCPlus.h> int PIN = 26; // +--- 15kΩ抵抗 --+-- CdSセル --+ // | | | // GND G26 3V3 // https://www.storange.jp/2012/03/arduinocds.html // 注意点: https://lang-ship.com/reference/unofficial/M5StickC/Peripherals/ADC/ void setup() { M5.begin(115200); pinMode(PIN, ANALOG); // PINのモード設定 // https://lang-ship.com/blog/work/m5stickc-io/ } void loop() { Serial.printf("%04d\n", analogRead(PIN) ); // 暗 0〜4095 明 delay(1000); }