Skip to content

Instantly share code, notes, and snippets.

@9arduino
9arduino / dht22.ino
Last active April 23, 2025 13:57
ตัวอย่าง การใช้งาน Sensor DHT22 https://www.ab.in.th/b/22
/*
ตัวอย่าง การใช้งาน Sensor DHT22 สินค้า
บทความ : https://www.ab.in.th/b/22
Download Library LCD I2C : https://download.เอบี.ไทย/d.php?file=Arduino-LiquidCrystal-I2C-library-master.zip
Download Library DHT22 : https://download.เอบี.ไทย/d.php?file=DHT-sensor-library-master.zip
*/
#include "DHT.h"
#define DHTPIN 2 // what digital pin we're connected to
@9arduino
9arduino / DS3231.ino
Last active April 23, 2025 13:55
สอนใช้งาน DS3231 โมดูลนาฬิกา ตั้งเวลา ง่ายๆ https://www.ab.in.th/b/58
/*
สอนใช้งาน DS3231 โมดูลนาฬิกา ตั้งเวลา ง่ายๆ
บทความ https://www.ab.in.th/b/58
download : https://www.ab.in.th
*/
#include <Wire.h>
#include <SPI.h>
#include <RTClib.h>
@9arduino
9arduino / arduino lcd i2c.ino
Last active April 23, 2025 14:08
สอนใช้งาน จอ LCD IIC/I2C Interface ด้วย Arduino https://www.ab.in.th/b/57
/*
สอนใช้งาน จอ LCD IIC/I2C Interface ด้วย Arduino
จากบทความ https://www.ab.in.th/b/57
Download Library : http://download.เอบี.ไทย/download.php?file=Arduino-LiquidCrystal-I2C-library-master.zip
*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); //Module IIC/I2C Interface บางรุ่นอาจจะใช้ 0x3f
void setup()
@9arduino
9arduino / car-wifi.ino
Last active April 23, 2025 14:08
โปรเจค Arduino เปิดปิดไฟ ผ่าน App android ด้วย Bluetooth https://www.ab.in.th/b/9
/*
โปรเจค Arduino เปิดปิดไฟ ผ่าน App android ด้วย Bluetooth
จากบทความ https://www.ab.in.th/b/9
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); //Pin10 RX , Pin 11 TX
#define Relay1 2
#define Relay2 3
#define Relay3 4
@9arduino
9arduino / Nodemcu-Deepsleep.ino
Last active April 23, 2025 14:08
Nodemcu Deepsleep เข้า Mode ประหยัดพลังงาน https://www.ab.in.th/b/14
/*
จากบทความ Nodemcu Deepsleep เข้า Mode ประหยัดพลังงาน
https://www.ab.in.th/b/14
*/
void setup() {
Serial.begin(115200);
Serial.setTimeout(2000);
// Wait for serial to initialize.
@9arduino
9arduino / HC-SR501.ino
Last active April 23, 2025 14:07
สอนใช้งาน Sensor ตรวจจับการเคลื่อนไหว PIR (HC-SR501) https://www.ab.in.th/b/13
/*
จากบทความ สอนใช้งาน Sensor ตรวจจับการเคลื่อนไหว PIR (HC-SR501)
https://www.ab.in.th/b/13
*/
const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;
@9arduino
9arduino / hc-sr04.ino
Last active April 23, 2025 14:07
การใช้งาน hc-sr04 Arduino และตัวอย่างโปรแกรม https://www.ab.in.th/b/60
/*
การใช้งาน hc-sr04 Arduino และตัวอย่างโปรแกรม
https://www.ab.in.th/b/60
*/
#define echoPin 3 // Echo Pin
#define trigPin 2 // Trigger Pin
#define LEDPin 13 // Onboard LED
int maximumRange = 200; // Maximum range needed
@9arduino
9arduino / Water-flow-Sensor.ino
Last active April 23, 2025 14:07
การใช้งาน Code Water flow Sensor กับ Arduino https://www.ab.in.th/b/8
/*
การใช้งาน Code Water flow Sensor กับ Arduino
บทความ : https://www.ab.in.th/b/8
*/
volatile int flow_frequency;
unsigned int l_hour, f_val;
unsigned long ctTime, flow_val, cloopTime;
void flow () // Water flow Interrupt function
{
flow_frequency++; f_val++;
@9arduino
9arduino / I2C-Scanner.ino
Last active April 23, 2025 14:06
จากบทความ ค้นหา Address I2C ด้วย Arduino กันเถอะ https://www.ab.in.th/b/1
// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
/*
จากบทความ ค้นหา Address I2C ด้วย Arduino กันเถอะ
https://www.ab.in.th/b/1
*/
#include <Wire.h>
void setup() {
@9arduino
9arduino / Nodemcu-เปิดไฟผ่านเว็บ.ino
Last active April 23, 2025 14:06
Nodemcu esp8266 Arduino IDE เปิดปิดไฟผ่าน Website https://www.ab.in.th/b/27
/*
Nodemcu esp8266 Arduino IDE เปิดปิดไฟผ่าน Website
https://www.ab.in.th/b/27
*/
#include <ESP8266WiFi.h>
const char* ssid = "9arduino";
const char* password = "tv357911itv";