Created
August 22, 2025 15:04
-
-
Save maxpromer/7617ee05bb4040695a70e40c8490a1da 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 | |
| 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