<?xml version="1.0" encoding="UTF-8" ?><!-- generator=Zoho Sites --><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><atom:link href="https://www.yantronix.in/blogs/tag/arduino/feed" rel="self" type="application/rss+xml"/><title>YANTRONIX - Blog #arduino</title><description>YANTRONIX - Blog #arduino</description><link>https://www.yantronix.in/blogs/tag/arduino</link><lastBuildDate>Thu, 09 Apr 2026 03:00:02 +0530</lastBuildDate><generator>http://zoho.com/sites/</generator><item><title><![CDATA[Enter your post title]]></title><link>https://www.yantronix.in/blogs/post/Smart-Parking-System-using-Arduino-and-LCD-Display</link><description><![CDATA[<img align="left" hspace="5" src="https://www.yantronix.in/Untitled-1 -1-.png?v=1760813314"/>The Smart Parking System uses an Arduino, ultrasonic sensors, and LCD display to detect vehicle presence and show available parking slots in real time. It improves parking efficiency, reduces manual effort, and can be upgraded with IoT features for smart city applications.]]></description><content:encoded><![CDATA[
<div class="zpcontent-container blogpost-container "><div data-element-id="elm_BRanjrt3R9Od1mn248pl9A" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer"><div data-element-id="elm_ZwjaYUJbSg2i97n5Pp4u3Q" data-element-type="row" class="zprow zpalign-items- zpjustify-content- "><style type="text/css"></style><div data-element-id="elm_1sa5cahZTKSIp1iSfr-8sg" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_9CTSgUycSTOgxR4olGd50A" data-element-type="heading" class="zpelement zpelem-heading "><style></style><h2
 class="zpheading zpheading-align-center " data-editor="true">The face of the moon was in shadow</h2></div>
<div data-element-id="elm_54KLmm9LRT2yf4aYu7YuNg" data-element-type="text" class="zpelement zpelem-text "><style></style><div class="zptext zptext-align-center " data-editor="true"><p>You can edit text on your website by double clicking on a text box on your website. Alternatively, when you select a text box a settings menu will appear. your website by double clicking on a text box on your website. Alternatively, when you select a text box.</p></div>
</div><div data-element-id="elm_kWYo5Za8TOSMSdtl-exanQ" data-element-type="button" class="zpelement zpelem-button "><style></style><div class="zpbutton-container zpbutton-align-center"><style type="text/css"></style><a role="button" class="zpbutton-wrapper zpbutton zpbutton-type-primary zpbutton-size-md " href="javascript:;" target="_blank"><span class="zpbutton-content">Get Started Now</span></a></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Sun, 19 Oct 2025 00:51:56 +0530</pubDate></item><item><title><![CDATA[Enter your post title]]></title><link>https://www.yantronix.in/blogs/post/Touchless-Water-Dispenser-using-Arduino</link><description><![CDATA[<img align="left" hspace="5" src="https://www.yantronix.in/Untitled-1.png?v=1760775817"/>The Touchless Water Dispenser utilizes an Arduino, an IR sensor, and a relay to dispense water automatically when a hand is detected. It ensures hygiene and saves water by providing a contact-free operation. Ideal for homes, offices, hospitals, and public places.]]></description><content:encoded><![CDATA[
<div class="zpcontent-container blogpost-container "><div data-element-id="elm_3q3gaFrbTeGA8rVJaZ7HaA" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer"><div data-element-id="elm_nUIvKrcSTHOupeRkk9N74w" data-element-type="row" class="zprow zpalign-items- zpjustify-content- "><style type="text/css"></style><div data-element-id="elm_z3_mtCzKRZqQFa_5YQjTqw" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_x4cmeK59Q0OTFtjSJpeoQQ" data-element-type="heading" class="zpelement zpelem-heading "><style></style><h2
 class="zpheading zpheading-align-center " data-editor="true">The face of the moon was in shadow</h2></div>
<div data-element-id="elm_4ZhNsyz9T7OPKHofnzJpdA" data-element-type="text" class="zpelement zpelem-text "><style></style><div class="zptext zptext-align-center " data-editor="true"><p>You can edit text on your website by double clicking on a text box on your website. Alternatively, when you select a text box a settings menu will appear. your website by double clicking on a text box on your website. Alternatively, when you select a text box.</p></div>
</div><div data-element-id="elm_WPOK1mn4SBK04SfoElgZYQ" data-element-type="button" class="zpelement zpelem-button "><style></style><div class="zpbutton-container zpbutton-align-center"><style type="text/css"></style><a role="button" class="zpbutton-wrapper zpbutton zpbutton-type-primary zpbutton-size-md " href="javascript:;" target="_blank"><span class="zpbutton-content">Get Started Now</span></a></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Sat, 18 Oct 2025 13:53:43 +0530</pubDate></item><item><title><![CDATA[Smart Temperature Detection System with LCD Display using Arduino]]></title><link>https://www.yantronix.in/blogs/post/Smart-Temperature-Detection-System-with-LCD-Display-using-Arduino</link><description><![CDATA[<img align="left" hspace="5" src="https://www.yantronix.in/Untitled-2 -2-.png?v=1760683263"/>Smart Temperature Detection System using Arduino measures real-time temperature with an LM35 sensor and displays it on a 16x2 LCD. A buzzer alerts when temperature exceeds a set limit. Ideal for home, industrial, and IoT applications with scope for cloud-based upgrades.]]></description><content:encoded><![CDATA[
<div class="zpcontent-container blogpost-container "><div data-element-id="elm_B4kdBaHMQjWeYOy6_lA1Pw" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer"><div data-element-id="elm_Ty2WUFR1S4SpHEQe-sz4CQ" data-element-type="row" class="zprow zpalign-items- zpjustify-content- "><style type="text/css"></style><div data-element-id="elm_UWKbA6e2RC6iOvE2DSyaCg" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- zpsticky-enabled"><style type="text/css"> [data-element-id="elm_UWKbA6e2RC6iOvE2DSyaCg"].zpelem-col{ margin-block-start:61px; } @media (min-width:992px) { [data-element-id="elm_UWKbA6e2RC6iOvE2DSyaCg"].zpelem-col{ top:0px;z-index:1; } } </style><div data-element-id="elm_7rWUCsN5Tha-1IZLJHPm2g" data-element-type="heading" class="zpelement zpelem-heading "><style></style><h2
 class="zpheading zpheading-align-center " data-editor="true"><span style="color:inherit;">Smart Temperature Detection System with LCD Display using Arduino</span></h2></div>
<div data-element-id="elm_RsrMBp4jhtDLgCtQY0GuRQ" data-element-type="text" class="zpelement zpelem-text "><style></style><div class="zptext zptext-align-left " data-editor="true"><div style="color:inherit;"><h2><strong>Objective:</strong></h2><p>To design a smart temperature monitoring system that measures real-time temperature using a digital sensor and displays it on an LCD screen. The system can also trigger alerts if the temperature exceeds a set threshold.</p><hr><h2><strong>Components Required:</strong></h2><ol><li><p><strong>Arduino Uno</strong> – Main microcontroller board</p></li><li><p><strong>LM35 / DHT11 / DS18B20 Temperature Sensor</strong> – For temperature measurement</p></li><li><p><strong>16x2 LCD Display</strong> – To show temperature readings</p></li><li><p><strong>10kΩ Potentiometer</strong> – For LCD contrast adjustment</p></li><li><p><strong>Buzzer (optional)</strong> – For over-temperature alert</p></li><li><p><strong>LED (optional)</strong> – To indicate high temperature</p></li><li><p><strong>Jumper Wires</strong></p></li><li><p><strong>Breadboard</strong></p></li><li><p><strong>USB Cable</strong> – For power and programming</p></li></ol><hr><h2><strong>Circuit Connections:</strong></h2><h3><span style="font-size:18px;">If using LM35 Sensor:</span></h3><ul><li><p><strong>Vout</strong> → Arduino <strong>A0</strong></p></li><li><p><strong>VCC</strong> → Arduino <strong>5V</strong></p></li><li><p><strong>GND</strong> → Arduino <strong>GND</strong></p></li></ul><h3>LCD Display (16x2) Connections:</h3><div><div style="color:inherit;"><table><thead><tr><th>LCD Pin</th><th>Arduino Pin</th></tr></thead><tbody><tr><td>VSS</td><td>GND</td></tr><tr><td>VDD</td><td>5V</td></tr><tr><td>V0</td><td>Middle pin of Potentiometer</td></tr><tr><td>RS</td><td>12</td></tr><tr><td>RW</td><td>GND</td></tr><tr><td>E</td><td>11</td></tr><tr><td>D4</td><td>5</td></tr><tr><td>D5</td><td>4</td></tr><tr><td>D6</td><td>3</td></tr><tr><td>D7</td><td>2</td></tr><tr><td>A (LED+)</td><td>5V (through 220Ω resistor)</td></tr><tr><td>K (LED−)</td><td>GND</td></tr></tbody></table></div></div></div></div>
</div><div data-element-id="elm_dsd9L3FlTX_dFN6aYxiL4g" data-element-type="text" class="zpelement zpelem-text "><style></style><div class="zptext zptext-align-left " data-editor="true"><div style="color:inherit;"><h2><strong>Working Principle:</strong></h2><ol><li><p>The <strong>LM35 sensor</strong> senses the surrounding temperature and provides an analog output proportional to the temperature.</p></li><li><p>Arduino reads this analog voltage from the sensor.</p></li><li><div style="color:inherit;"><p>The voltage is converted into temperature in °C using the formula:</p><span style="color:inherit;">Temperature(°C)=&nbsp;</span><span style="color:inherit;">(analogValue∗</span><span style="color:inherit;">5.0∗</span><span style="color:inherit;">100)/1024</span></div></li><li><p>The measured temperature is displayed on the <strong>LCD screen</strong>.</p></li><li><p>If the temperature exceeds the threshold (say <strong>35°C</strong>), the <strong>buzzer</strong> or <strong>LED</strong> turns ON to indicate a high temperature.</p></li></ol><div><div><span style="color:inherit;font-size:24px;font-family:Comfortaa, sans-serif;"><strong>Arduino Code:</strong></span></div></div><div><div style="color:inherit;"><div>#include &lt;LiquidCrystal.h&gt;</div><div>LiquidCrystal lcd(12, 11, 5, 4, 3, 2);&nbsp; // LCD pin configuration</div><div>int sensorPin = A0;&nbsp; // LM35 connected to A0</div><div>int buzzer = 8;&nbsp; &nbsp; &nbsp; // Buzzer or LED</div><div>float tempC;</div><div>void setup() {</div><div>&nbsp; lcd.begin(16, 2);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Initialize LCD</div><div>&nbsp; pinMode(buzzer, OUTPUT);&nbsp; &nbsp;// Set buzzer pin as output</div><div>&nbsp; lcd.print(&quot;Temp Monitor&quot;);</div><div>&nbsp; delay(2000);</div><div>&nbsp; lcd.clear();</div><div>}</div><div>void loop() {</div><div>&nbsp; int sensorValue = analogRead(sensorPin);</div><div>&nbsp; tempC = (sensorValue * 5.0 * 100) / 1024.0; // Convert to Celsius</div><div>&nbsp; lcd.setCursor(0, 0);</div><div>&nbsp; lcd.print(&quot;Temp: &quot;);</div><div>&nbsp; lcd.print(tempC);</div><div>&nbsp; lcd.print(&quot; C&nbsp; &nbsp;&quot;);</div><div>&nbsp; if (tempC &gt; 35.0) {</div><div>&nbsp; &nbsp; digitalWrite(buzzer, HIGH);</div><div>&nbsp; &nbsp; lcd.setCursor(0, 1);</div><div>&nbsp; &nbsp; lcd.print(&quot;HIGH TEMP ALERT!&quot;);</div><div>&nbsp; } else {</div><div>&nbsp; &nbsp; digitalWrite(buzzer, LOW);</div><div>&nbsp; &nbsp; lcd.setCursor(0, 1);</div><div>&nbsp; &nbsp; lcd.print(&quot;Status: Normal&nbsp; &quot;);</div><div>&nbsp; }</div><div>&nbsp; delay(1000);</div><div>}</div><br/><div><br/></div></div></div></div></div>
</div><div data-element-id="elm_ortuyrCIQGWnT0vBn7zLCA" data-element-type="button" class="zpelement zpelem-button "><style></style><div class="zpbutton-container zpbutton-align-center"><style type="text/css"></style><a role="button" class="zpbutton-wrapper zpbutton zpbutton-type-primary zpbutton-size-md zpbutton-style-none " href="javascript:;" target="_blank"><span class="zpbutton-content">Get Started Now</span></a></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Fri, 17 Oct 2025 12:58:22 +0530</pubDate></item><item><title><![CDATA[Build Your Own Clap-Activated Switch: A Fun Arduino Project!]]></title><link>https://www.yantronix.in/blogs/post/clap-switch</link><description><![CDATA[<img align="left" hspace="5" src="https://www.yantronix.in/clap_switch_cover.png?v=1760464337"/>Turn your lights on or off — just by clapping! sound-activated switch using an Arduino, a sound sensor, and an LED. It’s a simple yet powerful way to understand how digital input and output work in microcontrollers — perfect for beginners in electronics and IoT.]]></description><content:encoded><![CDATA[
<div class="zpcontent-container blogpost-container "><div data-element-id="elm_ng3KXg4FTdyjp0YC9Y3pyA" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer"><div data-element-id="elm_E8OIslxrRQmWKm32q9Hrsg" data-element-type="row" class="zprow zpalign-items- zpjustify-content- "><style type="text/css"></style><div data-element-id="elm_Z1DVzLEZQci2MuQVx91FiQ" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"></style><div data-element-id="elm_OIK7eKSJhthBx52JQSbxVg" data-element-type="codeSnippet" class="zpelement zpelem-codesnippet "><div class="zpsnippet-container"><!-- ========================= SEO========================= --><meta name="title" content="Build Your Own Clap-Activated Switch: A Fun Arduino Project!"/><meta name="description" content="Make a sound-activated Arduino clap switch to toggle an LED with a simple clap. Beginner-friendly guide with wiring, code, and testing tips."/><meta name="keywords" content="Arduino clap switch, sound activated switch, Arduino LED project, sound sensor Arduino tutorial, IoT beginner project, Arduino DIY, home automation Arduino"/><!-- ========================= Styles (scoped)========================= --><style> :root{ --bg:#0b1220; --panel:#0f172a; --ink:#e5e7eb; --muted:#9aa3b2; --brand:#60a5fa; --accent:#22d3ee; --ok:#34d399; --warn:#f59e0b; --danger:#f87171; --ring:rgba(96,165,250,.35); } @media (prefers-color-scheme: light){ :root{ --bg:#ffffff; --panel:#f8fafc; --ink:#0f172a; --muted:#475569; --brand:#2563eb; --accent:#0891b2; --ok:#059669; --warn:#b45309; --danger:#dc2626; --ring:rgba(37,99,235,.25);} } .blog-wrap{font-family:Inter,system-ui,Segoe UI,Roboto,Arial,sans-serif; color:var(--ink); background:var(--bg); padding:24px; border-radius:14px;} .container{max-width:1080px;margin:0 auto;} .hero{position:relative;border-radius:16px;overflow:hidden;margin-bottom:20px;background:linear-gradient(135deg,rgba(34,197,94,.1),rgba(14,165,233,.1));} .hero img{width:100%;height:auto;display:block;opacity:.95} .hero .badge{position:absolute;top:16px;left:16px;background:rgba(0,0,0,.45);backdrop-filter:blur(6px);color:#fff;padding:6px 12px;border-radius:999px;font-size:12px;letter-spacing:.04em} .hero h1{position:absolute;bottom:16px;left:16px;right:16px;margin:0;padding:14px 16px;background:rgba(2,6,23,.65);color:#fff;border-radius:12px;font-weight:800} .topbar{display:flex;gap:12px;align-items:center;justify-content:space-between;margin:8px 0 22px} .btn{border:1px solid transparent;background:var(--brand);color:#fff;padding:10px 14px;border-radius:10px;font-weight:600;cursor:pointer} .btn.ghost{background:transparent;color:var(--brand);border-color:var(--brand)} .btn:focus{outline:3px solid var(--ring);outline-offset:2px} .toc{position:sticky;top:12px;background:var(--panel);border:1px solid rgba(148,163,184,.25);border-radius:14px;padding:14px} .grid{display:grid;grid-template-columns:280px 1fr;gap:20px} @media (max-width:980px){.grid{grid-template-columns:1fr}} .toc ul{list-style:none;margin:0;padding:0} .toc a{display:block;padding:8px 10px;border-radius:8px;color:var(--muted);text-decoration:none} .toc a:hover{background:rgba(148,163,184,.12);color:var(--ink)} .card{background:var(--panel);border:1px solid rgba(148,163,184,.25);border-radius:16px;padding:18px} .kv{display:grid;grid-template-columns:1fr 1fr;gap:16px} @media (max-width:760px){.kv{grid-template-columns:1fr}} .kv img{width:100%;border-radius:12px;border:1px solid rgba(148,163,184,.25)} .badge-row{display:flex;flex-wrap:wrap;gap:8px} .badge-chip{padding:6px 10px;border-radius:999px;background:rgba(96,165,250,.15);color:var(--brand);border:1px dashed var(--brand);font-size:12px} .tabs{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap} .tab-btn{padding:9px 12px;border-radius:10px;border:1px solid rgba(148,163,184,.35);background:transparent;color:var(--ink);cursor:pointer} .tab-btn.active{background:linear-gradient(180deg,rgba(96,165,250,.18),rgba(96,165,250,.05));border-color:var(--brand)} .tab-panel{display:none} .tab-panel.active{display:block;animation:fade .2s ease} @keyframes fade{from{opacity:.3;transform:translateY(4px)}to{opacity:1;transform:none}} .codebox{position:relative} .copy{position:absolute;top:8px;right:8px} pre{background:#0b1020;color:#e5e7eb;padding:16px;border-radius:12px;overflow:auto;border:1px solid rgba(148,163,184,.25)} .fig{margin:14px 0} .fig img{width:100%;border-radius:12px;border:1px solid rgba(148,163,184,.25);cursor:zoom-in} .gallery{display:grid;grid-template-columns:repeat(2,1fr);gap:12px} @media (max-width:720px){.gallery{grid-template-columns:1fr}} .callout{display:flex;gap:12px;padding:14px;border-radius:12px;border:1px dashed currentColor;margin:10px 0} .ok{color:var(--ok);background:rgba(52,211,153,.08)} .warn{color:var(--warn);background:rgba(245,158,11,.08)} .sim{display:flex;gap:14px;align-items:center;flex-wrap:wrap} .led{width:18px;height:18px;border-radius:50%;background:#111;border:2px solid #333;box-shadow:inset 0 0 10px #000} .led.on{background:#ff5959;box-shadow:0 0 16px #ff6a6a,inset 0 0 10px #600} .range{accent-color:var(--brand)} .accordion details{border:1px solid rgba(148,163,184,.35);border-radius:12px;margin:10px 0;padding:10px;background:var(--panel)} .accordion summary{cursor:pointer;font-weight:700} .footer-note{font-size:.92rem;color:var(--muted)} .toggle-theme{margin-left:auto} .small{font-size:.9rem;color:var(--muted)} </style><div class="blog-wrap"><div class="container"><!-- HERO --><div class="hero" id="top"><span class="badge">Beginner • Arduino • IoT</span><img src="/clap_switch_cover.png" alt="Clap-Activated Switch with Arduino - Cover Banner"><h1>Build Your Own Clap-Activated Switch: A Fun Arduino Project!</h1></div>
<div class="topbar"><div class="badge-row"><span class="badge-chip">Sound Sensor (D0)</span><span class="badge-chip">LED on D13</span><span class="badge-chip">Toggling Logic</span><span class="badge-chip">Debounce</span></div>
<button class="btn ghost toggle-theme" id="themeBtn" aria-pressed="false">🌗 Toggle Theme</button></div>
<div class="grid"><!-- TOC --><nav class="toc card" aria-label="On this page"><strong>Quick Nav</strong><ul><li><a href="#overview">Overview</a></li><li><a href="#build">Build</a></li><li><a href="#code">Code</a></li><li><a href="#test">Test</a></li><li><a href="#faq">FAQ</a></li></ul></nav><!-- MAIN --><main><!-- TABS --><div class="tabs"><button class="tab-btn active" data-tab="overview">Overview</button><button class="tab-btn" data-tab="build">Build</button><button class="tab-btn" data-tab="code">Code</button><button class="tab-btn" data-tab="test">Test</button></div>
<!-- OVERVIEW --><section id="overview" class="tab-panel active"><div class="card"><p><strong>Clap to switch an LED on or off!</strong> This project uses an Arduino, a sound sensor, and a simple state-toggle to create a smart, sound-activated switch. It’s a great first step into sensor inputs and digital outputs.</p><div class="kv"><div class="fig"><img src="/files/clap_switch_concept.png" alt="Concept: sound wave to Arduino logic to LED output"><p class="small">Concept: sound → logic → LED.</p></div>
<div class="fig"><img src="/files/clap_switch_wiring.png" alt="Arduino clap switch wiring diagram"><p class="small">Wiring: VCC/GND, D0→D9, LED→D13.</p></div>
</div><div class="callout ok"><div>✅ <strong>What you’ll learn:</strong> Digital inputs/outputs, toggle logic, basic debouncing, and quick troubleshooting.</div>
</div></div></section><!-- BUILD --><section id="build" class="tab-panel"><div class="card"><h2>🔧 Components</h2><ul><li><strong>Arduino Uno</strong> (or compatible)</li><li><strong>Sound Sensor Module</strong> with digital output (D0)</li><li><strong>LED</strong> + optional <strong>220 Ω</strong> resistor</li><li><strong>Breadboard</strong> &amp; <strong>Jumper Wires</strong></li><li><strong>USB Cable</strong> to upload code</li></ul><h3>⚙️ Connections</h3><ol><li>Sensor <strong>VCC → 5V</strong>, <strong>GND → GND</strong></li><li>Sensor <strong>D0 → D9</strong> (Arduino)</li><li>LED <strong>Anode → D13</strong> (via resistor), <strong>Cathode → GND</strong></li></ol><div class="gallery"><img src="/files/clap_switch_wiring.png" alt="Wiring diagram" data-zoom><img src="/files/clap_switch_code.png" alt="Code visual" data-zoom></div>
<div class="callout warn"><div>💡 If the LED flickers, lower sensitivity with the sensor potentiometer and keep jumper wires short.</div>
</div></div></section><!-- CODE --><section id="code" class="tab-panel"><div class="card"><h2>💻 Arduino Code</h2><div class="codebox"><button class="btn copy" id="copyBtn" title="Copy code">📋 Copy</button><pre><code id="sketch">int sensorPin = 9;   // Sound sensor pin (D0)
int ledPin = 13;     // LED pin
int clapState = 0;   // To store LED state
int sensorValue = 0; // To read sensor input

void setup() {
  pinMode(sensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = digitalRead(sensorPin);
  Serial.println(sensorValue);

  if (sensorValue == HIGH) {
    clapState = !clapState;       // Toggle LED state
    digitalWrite(ledPin, clapState);
    delay(2000);                  // Simple debounce / cooldown
  }
}</code></pre></div>
<p class="small">Paste into Arduino IDE → <strong>Tools ▸ Board</strong>: Arduino Uno → select <strong>Port</strong> → <strong>Upload</strong>.</p></div>
</section><!-- TEST/ INTERACTIVE DEMO --><section id="test" class="tab-panel"><div class="card"><h2>🚀 Test &amp; Simulate</h2><p>Simulate a clap and see the LED toggle, just like the real build.</p><div class="sim"><button id="clapBtn" class="btn">👏 Clap</button><div class="led" id="ledDot" aria-label="LED"></div>
<label>Cooldown (ms): <input type="number" id="cooldown" value="2000" min="0" step="100" style="width:100px;"></label></div>
<div class="sim" style="margin-top:10px;"><label for="sens">Sensor Sensitivity:</label><input class="range" id="sens" type="range" min="0" max="100" value="70"><span id="sensRead" class="small">70</span></div>
<div class="callout ok"><div>Tip: In hardware, turn the sensor’s tiny potentiometer to tune sensitivity. Here, the slider models that behavior.</div>
</div></div></section><!-- FAQ --><section id="faq" class="card accordion"><h2>FAQ</h2><details><summary>Can I switch a relay instead of an LED?</summary><p>Yes—use a relay module on a digital pin and switch AC loads. Follow proper electrical safety and isolation.</p></details><details><summary>The sensor triggers randomly. What helps?</summary><p>Reduce sensitivity (potentiometer), add a small cooldown (e.g., 1500–2500 ms), shorten jumpers, and avoid noisy power sources.</p></details><details><summary>Why the 2s delay?</summary><p>It’s a simple <em>debounce/cooldown</em> so multiple pulses from one clap don’t double-toggle the LED.</p></details><p class="footer-note">Images used: cover, wiring, code visual, and concept illustration were generated for your site and are safe for commercial use.</p></section><p class="small" style="margin-top:14px;"> 🎥 Reference video: <a href="https://www.youtube.com/watch?v=tKpHWrVDAho&t=182s" target="_blank" rel="noopener">Clap-Activated Switch Project</a>. </p></main></div>
</div></div><!-- ========================= Scripts (scoped)========================= --><script>
(function(){
  // Tabs
  const tabs = document.querySelectorAll('.tab-btn');
  const panels = document.querySelectorAll('.tab-panel');
  tabs.forEach(btn=>{
    btn.addEventListener('click',()=>{
      tabs.forEach(b=>b.classList.remove('active'));
      panels.forEach(p=>p.classList.remove('active'));
      btn.classList.add('active');
      document.getElementById(btn.dataset.tab)?.classList.add('active');
      // Scroll into view on mobile
      document.getElementById(btn.dataset.tab)?.scrollIntoView({behavior:'smooth',block:'start'});
    });
  });

  // Copy code
  const copyBtn = document.getElementById('copyBtn');
  const sketch = document.getElementById('sketch');
  copyBtn?.addEventListener('click', async ()=>{
    try{
      await navigator.clipboard.writeText(sketch.textContent);
      copyBtn.textContent = '✅ Copied';
      setTimeout(()=>copyBtn.textContent='📋 Copy',1500);
    }catch(e){ alert('Copy failed. Select and copy manually.'); }
  });

  // Lightbox (simple)
  document.querySelectorAll('[data-zoom]').forEach(img=>{
    img.addEventListener('click',()=>{
      const src = img.getAttribute('src');
      const overlay = document.createElement('div');
      overlay.style.cssText = `
        position:fixed;inset:0;background:rgba(0,0,0,.8);
        display:flex;align-items:center;justify-content:center;z-index:9999`;
      overlay.innerHTML = '<img src="'+src+'" style="max-width:96%;max-height:92%;border-radius:12px;box-shadow:0 10px 40px rgba(0,0,0,.6)" alt="zoom">';
      overlay.addEventListener('click',()=>overlay.remove());
      document.body.appendChild(overlay);
    });
  });

  // Theme toggle (adds a lightweight class to invert palette if needed)
  const btn = document.getElementById('themeBtn');
  btn?.addEventListener('click', ()=>{
    const pressed = btn.getAttribute('aria-pressed') === 'true';
    btn.setAttribute('aria-pressed', String(!pressed));
    document.documentElement.classList.toggle('force-light');
    if(document.documentElement.classList.contains('force-light')){
      // swap to light palette
      document.documentElement.style.setProperty('--bg', '#ffffff');
      document.documentElement.style.setProperty('--panel', '#f8fafc');
      document.documentElement.style.setProperty('--ink', '#0f172a');
      document.documentElement.style.setProperty('--muted', '#475569');
      document.documentElement.style.setProperty('--brand', '#2563eb');
      document.documentElement.style.setProperty('--accent', '#0891b2');
      document.documentElement.style.setProperty('--ring', 'rgba(37,99,235,.25)');
    } else {
      // revert by reloading (simplest)
      location.reload();
    }
  });

  // LED Simulation
  const clapBtn = document.getElementById('clapBtn');
  const led = document.getElementById('ledDot');
  const cool = document.getElementById('cooldown');
  const sens = document.getElementById('sens');
  const sensRead = document.getElementById('sensRead');
  let ledState = false;
  let locked = false;

  sens.addEventListener('input',()=>sensRead.textContent = sens.value);

  function toggleLED(){
    ledState = !ledState;
    led.classList.toggle('on', ledState);
  }

  clapBtn?.addEventListener('click', ()=>{
    if(locked) return;
    // Simulate threshold: higher sensitivity => easier to trigger
    const threshold = 100 - Number(sens.value);
    const clapStrength = Math.floor(Math.random()*100);
    if(clapStrength >= threshold){
      toggleLED();
      const wait = Math.max(0, Number(cool.value)||0);
      if(wait>0){
        locked = true;
        clapBtn.disabled = true;
        setTimeout(()=>{ locked=false; clapBtn.disabled=false; }, wait);
      }
    } else {
      clapBtn.textContent = '👏 (too quiet)';
      setTimeout(()=>clapBtn.textContent='👏 Clap',700);
    }
  });
})();
</script></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Tue, 14 Oct 2025 22:44:24 +0530</pubDate></item></channel></rss>