This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sensorPin = 3; | |
int indicator = 13; | |
void setup() { | |
pinMode(sensorPin, INPUT); | |
pinMode(indicator, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#define BH1750_ADDR 0x23 | |
int readBH1750(byte dev_addr) { | |
Wire.beginTransmission(dev_addr); | |
Wire.write(0x10); | |
if (Wire.endTransmission() != 0) return -1; | |
delay(200); | |
Wire.requestFrom((int)dev_addr, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define US100_Trig_PIN 22 | |
#define US100_Echo_PIN 23 | |
void setup() { | |
pinMode(US100_Trig_PIN, OUTPUT); | |
pinMode(US100_Echo_PIN, INPUT); | |
Serial.begin(115200); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define IN1 23 | |
#define IN2 22 | |
void setPWM(int ch, int duty) { | |
int new_duty = map(duty, 0, 100, 0, 1023); | |
ledcWrite(ch, new_duty); | |
} | |
void setup() { | |
// --- Setup PWM via LEDC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BTN_PIN 0 | |
#define RELAY_PIN 13 | |
void setup() { | |
pinMode(BTN_PIN, INPUT); | |
pinMode(RELAY_PIN, OUTPUT); | |
} | |
void loop() { | |
if (digitalRead(BTN_PIN) == LOW) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PWM_PIN 23 | |
#define Z_C_PIN 22 | |
int DimmerValue = 100; | |
hw_timer_t *timer = NULL; | |
void DimmerSetup() { | |
pinMode(PWM_PIN, OUTPUT); | |
pinMode(Z_C_PIN, INPUT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<WiFi.h> | |
#define WIFI_AP_NAME "ESP32 AP mode" | |
#define WIFI_AP_PASS NULL | |
void setup() { | |
Serial.begin(115200); | |
WiFi.mode(WIFI_AP); | |
WiFi.softAP(WIFI_AP_NAME, WIFI_AP_PASS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<WiFi.h> | |
#define WIFI_STA_NAME "MaxHome3BB" | |
#define WIFI_STA_PASS "xxxxxxxxxx" | |
void setup() { | |
Serial.begin(115200); | |
pinMode(LED_BUILTIN, OUTPUT); | |
Serial.println(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<WiFi.h> | |
#define WIFI_STA_NAME "xxxxxxxxxxx" | |
#define WIFI_STA_PASS "xxxxxxxxxxx" | |
WiFiServer server(80); | |
void setup() { | |
Serial.begin(115200); | |
pinMode(LED_BUILTIN, OUTPUT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<WiFi.h> | |
#define WIFI_STA_NAME "xxxxxxxxxx" | |
#define WIFI_STA_PASS "xxxxxxxxxx" | |
void setup() { | |
Serial.begin(115200); | |
pinMode(LED_BUILTIN, OUTPUT); | |
Serial.println(); |