SLIOT 2026 Workshop Materials
Installation Guide
Download this batchfile and run as administrator
Pinout Guide
Pin Reference

Safe Pins

Images are adopted from this article : https://lastminuteengineers.com/esp32-pinout-reference
Demonstration Guides
Blink
int LED_BUILTIN = 2;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
LED Fade
int LED_PIN = 4;
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_PIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
for (int brightness = 0; brightness <= 255; brightness++) {
analogWrite(LED_PIN, brightness);
delay(10); // Adjust the speed of fading
}
// Decrease brightness
for (int brightness = 255; brightness >= 0; brightness--) {
analogWrite(LED_PIN, brightness);
delay(10);
}
}
Buzzer
#define BUZZER_PIN 4 // sama as int Buzzer_pin = 4
int frequency = 200; //200hz
void setup() {
pinMode(BUZZER_PIN,OUTPUT);
}
void loop() {
tone(BUZZER_PIN,frequency,1000);
noTone(BUZZER_PIN);
delay(1000);
}
Servo Motor
/* ESP32 Servo Sweep */
#include <ESP32Servo.h>
const int servoPin = 4; /* GPIO14 */
Servo servo1;
void setup()
{
Serial.begin(115200);
servo1.attach(servoPin);
}
void loop()
{
for(int posDegrees = 0; posDegrees <= 180; posDegrees++) {
servo1.write(posDegrees);
Serial.println(posDegrees);
delay(20);
}
for(int posDegrees = 180; posDegrees >= 0; posDegrees--) {
servo1.write(posDegrees);
Serial.println(posDegrees);
delay(20);
}
}
Push Button - Active HIGH
Push Button - Active LOW
LDR-Analog Input
int pin = 4;
void setup() {
pinMode(pin,INPUT);
Serial.begin(115200);
}
void loop() {
int ldr_reading = analogRead(pin);
Serial.println(ldr_reading);
delay(1000);
}
DHT11
#include "DHT.h"
#define DHTPIN 4 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200);
Serial.println("DHTxx test!");
dht.begin();
}
void loop() {
delay(2000);
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C "));
Serial.println(f);
}
All together - Simple project
int ldrPin = 4;
int buzzerPin = 5;
// Threshold for detecting a shadow (you may need to adjust this)
// ESP32 analog reads go from 0 to 4095
int threshold = 1500;
void setup() {
pinMode(ldrPin, INPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(115200);
}
void loop() {
int ldr_reading = analogRead(ldrPin);
Serial.print("LDR Reading: ");
Serial.println(ldr_reading);
// If the reading drops below the threshold, a shadow is detected
if (ldr_reading < threshold) {
digitalWrite(buzzerPin, HIGH); // Turn the buzzer ON
} else {
digitalWrite(buzzerPin, LOW); // Turn the buzzer OFF
}
delay(500); // Reduced delay for better responsiveness
}
Servo Motors
Servo motor pinout
