This file contains 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 <Adafruit_NeoPixel.h> | |
#define PIN 6 // กำหนดพินที่เชื่อมต่อกับ WS2812 | |
#define NUMPIXELS 16 // กำหนดจำนวน LED ที่ใช้ | |
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); | |
void setup() { | |
pixels.begin(); // เริ่มต้นการทำงานของไลบรารี | |
} |
This file contains 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 IN1_PIN 6 // กำหนดขาต่อ IN1 เป็นขา 6 | |
#define IN2_PIN 5 // กำหนดขาต่อ IN2 เป็นขา 5 | |
void soft_start(int pin, int start, int end) { | |
if (start < end) { | |
for (int i=start;i<=end;i++) { | |
analogWrite(pin, i); | |
delay(5); | |
} | |
} else if (start > end) { |
This file contains 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 <POP32.h> | |
void setup() | |
{ | |
} | |
void loop() | |
{ | |
motor(1,30); | |
motor(2,30); | |
delay(3000); |
This file contains 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 IN1_PIN 6 // กำหนดขาต่อ IN1 เป็นขา 6 | |
#define IN2_PIN 5 // กำหนดขาต่อ IN2 เป็นขา 5 | |
void setup() { | |
pinMode(IN1_PIN, OUTPUT); // กำหนดขาที่ IN1 เป็น OUTPUT | |
pinMode(IN2_PIN, OUTPUT); // กำหนดขาที่ IN2 เป็น OUTPUT | |
} | |
void loop() { | |
// กำหนดให้มอเตอร์หมุนตามเข็ม |
This file contains 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 IN1_PIN 8 // กำหนดขาต่อ IN1 เป็นขา 8 | |
#define IN2_PIN 7 // กำหนดขาต่อ IN2 เป็นขา 7 | |
#define PWM_PIN 6 // กำหนดขาต่อ PWM เป็นขา 6 | |
void setup() { | |
pinMode(IN1_PIN, OUTPUT); // กำหนดขาที่ IN1 เป็น OUTPUT | |
pinMode(IN2_PIN, OUTPUT); // กำหนดขาที่ IN2 เป็น OUTPUT | |
pinMode(PWM_PIN, OUTPUT); // กำหนดขาที่ PWM เป็น OUTPUT | |
} |
This file contains 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> | |
#define RS485_RX_PIN (27) | |
#define RS485_TX_PIN (26) | |
ModbusMaster sensor; | |
void setup() { | |
Serial.begin(115200); |
This file contains 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> | |
#define RS485_RX_PIN (15) | |
#define RS485_TX_PIN (17) | |
#define RS485_DIR_PIN (16) | |
ModbusMaster sensor; | |
void preTransmission() { | |
digitalWrite(RS485_DIR_PIN, HIGH); |
This file contains 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
/* Dev by Artron Shop Co.,Ltd. */ | |
#include <Wire.h> | |
#include <Adafruit_BMP280.h> | |
#include <AHT20.h> | |
Adafruit_BMP280 bmp; | |
AHT20 aht20; | |
void setup() { |
This file contains 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
// See SetupX_Template.h for all options available | |
#define USER_SETUP_ID 1 | |
#define ILI9341_DRIVER | |
#define TFT_MISO 13 // (leave TFT SDO disconnected if other SPI devices share MISO) | |
#define TFT_MOSI 11 | |
#define TFT_SCLK 12 | |
#define TFT_CS 10 // Chip select control pin D8 | |
#define TFT_DC 21 // Data Command control pin |
This file contains 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
// Ref : https://adam-meyer.com/arduino/CD74HC4067 | |
// Mux control pins | |
int s0 = 8; | |
int s1 = 9; | |
int s2 = 10; | |
int s3 = 11; | |
// Mux in "SIG" pin | |
int SIG_pin = 0; |
NewerOlder