Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Created August 22, 2025 15:04
Show Gist options
  • Select an option

  • Save maxpromer/7617ee05bb4040695a70e40c8490a1da to your computer and use it in GitHub Desktop.

Select an option

Save maxpromer/7617ee05bb4040695a70e40c8490a1da to your computer and use it in GitHub Desktop.
#include <TinkerC6.h> // เรียกใช้ไลบรารี่ Tinker C6
void setup() {
Serial.begin(115200); // เริ่มใช้งาน Serial Monitor
TinkerC6.Power.enable12V(); // สั่งเปิดใช้ไฟเลี้ยง 12V
}
void loop() {
float mA = TinkerC6.Analog.getCurrent(); // อ่านค่าช่อง 4-20mA เก็บลงตัวแปร mA
Serial.printf("Analog is %.02f mA\n", mA); // แสดงผลค่าใน Serial Monitor
delay(1000); // หน่วงเวลา 1 วินาที
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment