Arduino 上手教程
StamPLC 内置温度传感器与电压电流检测相关API与案例程序。
/*
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
#include <Arduino.h>
#include <M5StamPLC.h>
void setup()
{
/* Init M5StamPLC */
M5StamPLC.begin();
}
void loop()
{
M5StamPLC.update();
/* Print sensors values */
printf("Temp: %.2f°C\n", M5StamPLC.getTemp());
printf("Power: %.2fV\n", M5StamPLC.getPowerVoltage());
printf("Io: %.2fA\n", M5StamPLC.getIoSocketOutputCurrent());
delay(1000);
}