Skip to content

Instantly share code, notes, and snippets.

View maxpromer's full-sized avatar

Max maxpromer

View GitHub Profile
/* Dev by Artron Shop Co.,Ltd. */
#include <Wire.h>
#include <Adafruit_BMP280.h>
#include <AHT20.h>
Adafruit_BMP280 bmp;
AHT20 aht20;
void setup() {
@maxpromer
maxpromer / Setup1_ILI9341.h
Created April 23, 2024 10:17
คอนฟิกสำหรับ TFT_eSPI ใช้กับบอร์ดจอ ATD3.2-S3 Lite
// 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
// 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;
void setup() {
Serial.begin(9600);
}
void loop() {
unsigned int AnalogValue;
AnalogValue = analogRead(A0);
Serial.println(AnalogValue);
}
#define SIG_PIN 4 // กำหนดขาที่ต้อ SIG
#define EN_PIN 16 // กำหนดขาที่ต่อ EN
#define COIN_VALUE 10 // กำหนดเหรียญที่ใส่ในเครื่อง เพื่อให้คำนวณยอดเงินถูกต้อง
int count = 0; // ตัวแปรนับ Pulse ที่เครื่องรับเหรียญส่งเข้ามา
bool count_update_flag = false; // ตัวแปรเก็บค่าว่า count อัพเดทแล้ว
void pulse_in_cb() { // เมื่อได้รับ Pulse
count_update_flag = true;
}
#define SIG_PIN 4 // กำหนดขาที่ต้อ SIG
#define EN_PIN 16 // กำหนดขาที่ต่อ EN
bool count_update_flag = false; // ตัวแปรเก็บค่าว่า count อัพเดทแล้ว
void pulse_in_cb() { // เมื่อได้รับ Pulse
count_update_flag = true;
}
void setup() {
#define SIG_PIN 4 // กำหนดขาที่ต้อ SIG
#define EN_PIN 16 // กำหนดขาที่ต่อ EN
void setup() {
pinMode(SIG_PIN, INPUT); // กำหนดขา SIG เป็นอินพุต
pinMode(EN_PIN, OUTPUT); // กำหนดขา EN เป็นอินพุต
digitalWrite(EN_PIN, HIGH); // สั่งให้ขา EN เป็นลอจิก 1 (HIGH) เพื่อให้รับเหรียญ
Serial.begin(115200); // ใช้ Serial ที่ความเร็ว 115200
}
#include <Wire.h>
#include <AHT10.h> // AHT10 Arduino library that can be downloaded from here https://github.com/enjoyneering/AHT10
AHT10Class AHT10;
void setup() {
Serial.begin(9600);
Wire.begin();
if (AHT10.begin(eAHT10Address_Low))
function doGet(e) {
Logger.log(JSON.stringify(e));
var result = 'Ok';
if ((!e) || e.parameter == 'undefined') {
result = 'No Parameters';
}
else {
var sheet_id = '10rTTvj3XmHhh2mrXOlFySaBB1DWFF-vXgEjziFkG56I'; // Spreadsheet ID
var sheet = SpreadsheetApp.openById(sheet_id).getActiveSheet();
var newRow = sheet.getLastRow() + 1;
/*
Web client
This sketch connects to a website (http://www.google.com)
using an Arduino WIZnet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009