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 |
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
const uint8_t io[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 18, 19, 20, 21, 22, 23 }; | |
void setup() { | |
for (int i=0;i<sizeof(io);i++) { | |
pinMode(io[i], OUTPUT); | |
} | |
} | |
void loop() { | |
for (int i=0;i<sizeof(io);i++) { |
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
void setup() { | |
pinMode(3, OUTPUT); // กำหนดขาเชื่อมต่อรีเลย์ (GPIO3) เป็นดิจิทัลเอาต์พุต | |
} | |
void loop() { | |
digitalWrite(3, HIGH); // สั่งรีเลย์ทำงาน | |
delay(1000); // หน่วงเวลา 1 วินาที (1000 mS) | |
digitalWrite(3, LOW); // สั่งรีเลย์หยุดทำงาน | |
delay(1000); // หน่วงเวลา 1 วินาที (1000 mS) | |
} |
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
//Parameters | |
const int gp2y0a21Pin = A0; | |
//Variables | |
int gp2y0a21Val = 0; | |
void setup() { | |
//Init Serial USB | |
Serial.begin(9600); | |
Serial.println(F("Initialize System")); |
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
Alert.begin(<Room token>); // เริ่มต้นใช้ Am Alert กำหนด ROOM token |
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 <WiFi.h> // นำเข้าไลบรารี่ WiFi | |
const char* ssid = "your-ssid"; // ชื่อ WiFi | |
const char* password = "your-password"; // รหัสผ่าน WiFi | |
void setup() { | |
Serial.begin(115200); // เริ่มต้นใช้ Serial ที่ความเร็ว 115200 | |
while(!Serial){delay(100);} | |
// We start by connecting to a WiFi network |
NewerOlder