Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Created August 22, 2025 14:09
Show Gist options
  • Save maxpromer/b26e4363ac860b1b811aed474ba754e0 to your computer and use it in GitHub Desktop.
Save maxpromer/b26e4363ac860b1b811aed474ba754e0 to your computer and use it in GitHub Desktop.
#include <TinkerC6.h> // เรียกใช้ไลบรารี่ Tinker C6
void setup() {
Serial.begin(115200); // เริ่มใช้งาน Serial Monitor
}
void loop() {
int soc = TinkerC6.Power.getSOC(); // อ่านค่า % แบตเตอรี่ เก็บลงตัวแปร soc
float v_cell = TinkerC6.Power.getBatteryVoltage(); // อ่านค่าแรงดันแบตเตอรี่ เก็บลงตัวแปร v_cell
Serial.printf("Batt SOC: %d%%\tVolt: %.02fV\n", soc, v_cell); // แสดงผลค่าใน Serial Monitor
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment