Skip to content

Instantly share code, notes, and snippets.

void setup() {
Serial.begin(115200);
}
void loop() {
int a = analogRead(A0); // อ่านค่าแบบ Analog
int d = digitalRead(7); // อ่านค่าแบบ Digital
Serial.print(a);
Serial.print(" ");
#include <Wire.h>
#include "Adafruit_VL6180X.h"
Adafruit_VL6180X vl = Adafruit_VL6180X();
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(1);
}
//Example By www.allnewstep.com
#include "DFRobot_SHT20.h"
DFRobot_SHT20 sht20(&Wire, SHT20_I2C_ADDR);
void setup()
{
Serial.begin(115200);
sht20.initSHT20();
// Example By www.allnewstep.com
#include <FastLED.h>
#define NUM_LEDS 1 // จำนวน LED ที่ต่อ
#define DATA_PIN 5 // ขา DIN
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
int led_r = 3;
int led_g = 4;
int led_b = 5;
void setup() {
pinMode(led_r, OUTPUT);
pinMode(led_g, OUTPUT);
pinMode(led_b, OUTPUT);
Serial.begin(9600);
Serial.println("Start");
#include "SHT85.h"
uint32_t start;
uint32_t stop;
SHT85 sht;
void setup()
{
Serial.begin(115200);
Wire.begin();
sht.begin(0x44);
/*
* JSN-SR04T Ultrasonic Range Finder Ping Mode Test
*
* Exercises the ultrasonic range finder module and prints out measured distance
* 5V - connect to 5V
* GND - connect to ground
* RX/TRIG - connect to digital pin 12. Can be any digital pin
* TX/ECHO - connect to digital pin 13. Can be any digital pin
*/
const int TRIG_PIN = 12;
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
sensors_event_t humidity, temp;
void setup() {
Serial.begin(115200);
if (! aht.begin()) {
Serial.println("Could not find AHT? Check wiring");
while (1) delay(10);
}
#include <BH1750FVI.h>
BH1750FVI LightSensor(BH1750FVI::k_DevModeContLowRes);
void setup()
{
Serial.begin(115200);
LightSensor.begin();
}
//www.allnewstep.com
/*! @file I2CDemo.ino
@section I2CDemo_intro_section Description
Example program for using I2C to set and read the Bosch BME680 sensor. The sensor measures
temperature, pressure and humidity and is described at
https://www.bosch-sensortec.com/bst/products/all_products/BME680. The datasheet is available from
Bosch at https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME680_DS001-11.pdf \n\n