Created
August 22, 2025 14:09
-
-
Save maxpromer/b26e4363ac860b1b811aed474ba754e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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