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 |
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.RS485.begin(9600); // เริ่มใช้งาน RS485 | |
} | |
void loop() { | |
TinkerC6.RS485.enable(); // เปิดใช้งานส่วน RS485 | |
TinkerC6.RS485.println("Hello, RS485 !"); // ส่งข้อความออก RS485 |
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 | |
Serial.println("--- Begin ---"); // แสดงข้อความใน Serial Monitor | |
Serial.println("Enter to Light Sleep 5 sec"); // แสดงข้อความใน Serial Monitor | |
Serial.flush(); // รอจนกว่าจะส่งข้อมูลไปที่ Serial Monitor เสร็จ | |
TinkerC6.Power.enterToLightSleep(5000); // เข้า Light Sleep Mode เป็นเวลา 5 วินาที | |
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() { | |
} | |
void loop() { | |
TinkerC6.Power.enable12V(); // สั่งเปิดใช้ไฟเลี้ยง 12V | |
TinkerC6.Power.enterToLightSleep(5000); // หน่วงเวลา 5 วินาที ด้วย Light Sleep Mode | |
TinkerC6.Power.disable12V(); // สั่งปิดไฟเลี้ยง 12V | |
TinkerC6.Power.enterToLightSleep(5000); // หน่วงเวลา 5 วินาที ด้วย Light Sleep Mode |
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 |
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 "driver/gpio.h" | |
#include "driver/twai.h" | |
void setup() { | |
Serial.begin(115200); | |
twai_general_config_t g_config = { // สร้างต้วแปร g_config ใช้กำหนดค่าเกี่ยวกับบัส CAN | |
.mode = TWAI_MODE_NORMAL, | |
.tx_io = GPIO_NUM_26, // กำหนดขา TX ต่อกับ 26 | |
.rx_io = GPIO_NUM_27, // กำหนดขา TX ต่อกับ 27 |
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
// Copyright (c) Sandeep Mistry. All rights reserved. | |
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | |
#include <CAN.h> // the OBD2 library depends on the CAN library | |
#include <OBD2.h> | |
void setup() { | |
Serial.begin(9600); | |
while (!Serial); |
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 "MCM_BL0940.h" | |
BL0940 bl0940; | |
void setup() { | |
Serial.begin(115200); | |
bl0940.begin(Serial1, 25, 26); // RX, TX pin | |
bl0940.Reset(); | |
bl0940.setFrequency(50); // 50[Hz] |
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 "driver/gpio.h" | |
#include "driver/twai.h" | |
typedef float (*DataConvertFn)(uint32_t); | |
typedef struct { | |
int8_t mode; // Mode/UDS | |
uint16_t pid; | |
const char * name; | |
uint8_t size; // in byte |
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 "driver/gpio.h" | |
#include "driver/twai.h" | |
void setup() { | |
Serial.begin(115200); | |
twai_general_config_t g_config = { // สร้างต้วแปร g_config ใช้กำหนดค่าเกี่ยวกับบัส CAN | |
.mode = TWAI_MODE_NORMAL, | |
.tx_io = GPIO_NUM_26, // กำหนดขา TX ต่อกับ 26 | |
.rx_io = GPIO_NUM_27, // กำหนดขา TX ต่อกับ 27 |
NewerOlder