pdf-icon

Arduino Quick Start

StamPLC Sensor

StamPLC built-in temperature sensor and voltage/current detection related APIs and example program.

Example Program

cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
* 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);
}
On This Page