Skip to content

Instantly share code, notes, and snippets.

View bavensky's full-sized avatar
🐢
Working from home

Apirak Sang-ngenchai bavensky

🐢
Working from home
View GitHub Profile
@bavensky
bavensky / ESP8266 with 20x4 i2c LCD.ino
Last active February 13, 2024 13:01
ESP8266 with 20x4 i2c LCD [Arduino IDE]
// ESP8266 with 20x4 i2c LCD
// Compatible with the Arduino IDE 1.6.4
// Library https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
// Bavensky :3
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x20,20,4);
@bavensky
bavensky / list.md
Last active March 25, 2016 06:24
Orderlist.md

|ลำดับ|รายการ|จำนวน|ราคา| |---|---|---|---|---| |1|มอเตอร์ 500w|1|7,630| |2|แบตลิโพ|3|2,450| |3|ที่ชาร์จแบตลิโพ|3|1,495| |4|คันเร่งและเบรค|1|535| |5|ล้ออิสระ|4|1,200| |6|พวงมาลัย|1|1,500| |7|เบาะ|1|1,620| |8|คอรถจักรยาน|1|500|

/*********************************************
Chiang Mai Maker Club
ESPresso Lite V2.0
HC-SR04 Ultrasonic module
*********************************************/
#define ECHO 4 // Espresso lite pin 04
#define TRIG 5 // Espresso lite pin 05
void setup() {
// BT VCC to Arduino 5V out.
// BT GND to GND
// BT RX to Arduino pin 3 (through a voltage divider)
// BT TX to Arduino pin 2 (no need voltage divider)
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
// Connect the HC-05 TX to Arduino pin 2 RX.
// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.
// BT VCC to Arduino 5V out.
// BT GND to GND
// BT RX to Arduino pin 3 (through a voltage divider)
// BT TX to Arduino pin 2 (no need voltage divider)
//
// When a command is entered in the serial monitor on the computer
// the Arduino will relay it to the bluetooth module and display the result.
//
// These HC-06 modules require capital letters and no line ending
//
#include <SoftwareSerial.h>
SoftwareSerial mySerial (2, 3); // RX,TX
int swL = 4;
int swR = 5;
int val = 0; // variable for reading the pin status
int val2 = 0;
int inByte;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
#include <SoftwareSerial.h>
SoftwareSerial mySerial (2, 3); // RX,TX
int Led1 = 4;
int Led2 = 5;
int inByte;
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
pinMode(Led1, OUTPUT);
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiUdp.h>
#include <functional>
void prepareIds();
boolean connectWifi();
boolean connectUDP();
void startHttpServer();
void turnOnRelay();
[{"id":"e094e614.03c248","type":"ui_chart","z":"a2e2f8bd.8c9d48","name":"ECG","group":"6ced8d3d.ae8664","order":1,"width":"10","height":"5","label":"คลื่นไฟฟ้าสมอง (ECG)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"0","ymax":"100","removeOlder":"1","removeOlderPoints":"100","removeOlderUnit":"60","cutout":0,"colors":["#ff0000","#0000ff","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"x":505,"y":632,"wires":[[],[]]},{"id":"da5bf8f3.031078","type":"inject","z":"a2e2f8bd.8c9d48","name":"interval mqtt","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"x":175,"y":249,"wires":[["3943655e.1384ca","d72f37e9.4d0878","bd6b22da.cfdf","860dbab4.e38218","50a685d4.6e196c","59762bb0.866cf4","f3aef5e2.ba6aa8","cc6187bd.321868","e2d13dc8.c03f3"]]},{"id":"4fb51818.04d348","type":"mqtt out","z":"a2e2f8bd.8c9d48","name":"","topic":"meditable/pulse","qos":"0","retain":"","broker":"192480b9.e5063f","x":674,"y":444,"wi
@bavensky
bavensky / SeniorPJ 050417
Created April 4, 2017 17:08
SeniorPJ 050417
[{"id":"e094e614.03c248","type":"ui_chart","z":"a2e2f8bd.8c9d48","name":"ECG","group":"6ced8d3d.ae8664","order":1,"width":"10","height":"5","label":"คลื่นไฟฟ้าหัวใจ (ECG)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"0","ymax":"250","removeOlder":"30","removeOlderPoints":"100","removeOlderUnit":"1","cutout":0,"colors":["#0000ff","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"x":500,"y":491,"wires":[[],[]]},{"id":"da5bf8f3.031078","type":"inject","z":"a2e2f8bd.8c9d48","name":"interval mqtt","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":false,"x":234,"y":179,"wires":[["3943655e.1384ca","d72f37e9.4d0878","bd6b22da.cfdf","860dbab4.e38218","50a685d4.6e196c","59762bb0.866cf4","111de8f1.783f67"]]},{"id":"4fb51818.04d348","type":"mqtt out","z":"a2e2f8bd.8c9d48","name":"","topic":"meditable/pulse","qos":"0","retain":"","broker":"192480b9.e5063f","x":671,"y":251,"wires":[]},{"id":"3943655e.1384ca","