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
| #define RELAY_PIN (5) // ขาที่ต่อรีเลย์ | |
| void setup() { | |
| pinMode(RELAY_PIN, OUTPUT); | |
| } | |
| void loop() { | |
| digitalWrite(RELAY_PIN, LOW); // สั่งโซลินอยด์ทำงาน | |
| delay(2000); | |
| digitalWrite(RELAY_PIN, HIGH); // สั่งโซลินอยด์หยุดทำงาน |
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
| /*************************************************** | |
| This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865 | |
| Designed specifically to work with the Adafruit RTD Sensor | |
| ----> https://www.adafruit.com/products/3328 | |
| This sensor uses SPI to communicate, 4 pins are required to | |
| interface | |
| Adafruit invests time and resources providing this open source code, | |
| please support Adafruit and open-source hardware by purchasing |
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
| import time | |
| import smbus | |
| class PCA9685: | |
| """ | |
| This class provides an interface to the I2C PCA9685 PWM chip. | |
| The chip provides 16 PWM channels. | |
| All channels use the same frequency which may be set in the | |
| range 24 to 1526 Hz. | |
| If used to drive servos the frequency should normally be set |
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
| import PCA9685 | |
| import time | |
| servo = PCA9685.PCA9685(address=0x40) # defaults to bus 1, address 0x40 | |
| while True: | |
| servo.set_angle(-1, 0) | |
| time.sleep(2) | |
| servo.set_angle(-1, 45) | |
| time.sleep(2) | |
| servo.set_angle(-1, 90) |
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(LED_BUILTIN, OUTPUT); | |
| } | |
| void loop() { | |
| analogWrite(LED_BUILTIN, 0); | |
| delay(2000); | |
| analogWrite(LED_BUILTIN, 64); | |
| delay(2000); | |
| analogWrite(LED_BUILTIN, 127); |
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
| #define RX_PIN (26) // กำหนดขาต่อ RX VC-02-Kit | |
| #define TX_PIN (27) // กำหนดขาต่อ TX VC-02-Kit | |
| #define LED_PIN (5) // กำหนดขาต่อ LED | |
| void setup() { | |
| pinMode(LED_PIN, OUTPUT); // กำหนดขา LED เป็น Digital Output | |
| digitalWrite(LED_PIN, HIGH); // กำหนดลอจิก LED เป็น HIGH (ปิด LED) | |
| Serial.begin(115200); // ใช้งาน 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 <ModbusMaster.h> | |
| ModbusMaster decibel; | |
| void setup() { | |
| Serial.begin(115200); | |
| // Modbus communication runs at 9600 baud | |
| Serial2.begin(9600, SERIAL_8N1, 27, 26); // IOXESP32 Modbus RTU shield |
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 "OThreadCLI.h" | |
| void setup() { | |
| Serial.begin(115200); | |
| neopixelWrite(8, 0, 0, 0); | |
| OThreadCLI.begin(false); // No AutoStart - fresh start | |
| // Start Console | |
| Serial.println("OpenThread CLI started - type 'help' for a list of commands."); |
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 "OThreadCLI.h" | |
| #include "OThreadCLI_Util.h" | |
| void setup() { | |
| Serial.begin(115200); | |
| pinMode(9, INPUT_PULLUP); | |
| OThreadCLI.begin(false); // No AutoStart - fresh start | |
| // Start Console |
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 "OThreadCLI.h" | |
| #include "OThreadCLI_Util.h" | |
| void setup() { | |
| Serial.begin(115200); | |
| OThreadCLI.begin(false); // No AutoStart - fresh start | |
| // Start Console | |
| Serial.println("OpenThread CLI started - type 'help' for a list of commands."); |