Skip to content

Instantly share code, notes, and snippets.

@9arduino
9arduino / วัดอุณหภูมิ ด้วย LM35 Arduino.ino
Last active April 23, 2025 14:05
วัดอุณหภูมิ ด้วย LM35 Arduino https://www.ab.in.th/b/62
/*
วัดอุณหภูมิ ด้วย LM35 Arduino
https://www.ab.in.th/b/62
*/
int val;
int tempPin = A5; //ต่อ Sensor ที่ ขา A5
void setup() {
Serial.begin(9600);
@9arduino
9arduino / หรี่ความสว่างหลอดไฟ LED.ino
Last active April 23, 2025 14:06
หรี่ความสว่างหลอดไฟ LED ด้วย Arduino https://www.ab.in.th/b/54
/*
หรี่ความสว่างหลอดไฟ LED ด้วย Arduino
https://www.ab.in.th/b/54
*/
const int analogOutPin = 3; //กำหนดใช้งานขา 3 ของ Arduino
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";
@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 / 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 / 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 / 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 / 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 / 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 / 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()