|
|
<!DOCTYPE html> |
|
|
<html lang="en"> |
|
|
<head> |
|
|
<meta charset="UTF-8"> |
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
<title>Arduino Code Reference - DocVortex</title> |
|
|
<link rel="icon" type="image/x-icon" href="/static/favicon.ico"> |
|
|
<link rel="stylesheet" href="style.css"> |
|
|
<script src="https://cdn.tailwindcss.com"></script> |
|
|
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> |
|
|
<script src="https://unpkg.com/feather-icons"></script> |
|
|
</head> |
|
|
<body class="bg-gray-900 text-white overflow-x-hidden"> |
|
|
|
|
|
|
|
|
<doc-navbar></doc-navbar> |
|
|
|
|
|
|
|
|
<section class="pt-24 pb-12 px-4"> |
|
|
<div class="max-w-7xl mx-auto"> |
|
|
<div class="text-center mb-16"> |
|
|
<h1 class="text-5xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-cyan-400 via-purple-500 to-pink-500 bg-clip-text text-transparent"> |
|
|
Arduino Code Reference |
|
|
</h1> |
|
|
<p class="text-xl text-gray-300 max-w-3xl mx-auto"> |
|
|
Complete reference for Arduino programming language, functions, and libraries. |
|
|
</p> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="max-w-2xl mx-auto mb-12"> |
|
|
<div class="relative"> |
|
|
<input type="text" placeholder="Search functions, libraries, or keywords..." |
|
|
class="w-full px-6 py-4 bg-gray-800/50 backdrop-blur-sm rounded-full border border-white/20 focus:outline-none focus:border-cyan-500 focus:ring-2 focus:ring-cyan-500/20 text-white placeholder-gray-400"> |
|
|
<button class="absolute right-2 top-2 p-3 bg-gradient-to-r from-cyan-500 to-purple-600 rounded-full"> |
|
|
<i data-feather="search" class="w-5 h-5"></i> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="grid md:grid-cols-3 lg:grid-cols-4 gap-6 mb-16"> |
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-cyan-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-cyan-500 to-blue-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="zap" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">Digital I/O</h3> |
|
|
<p class="text-gray-400 text-sm">pinMode(), digitalRead(), digitalWrite()</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-purple-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-purple-500 to-pink-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="trending-up" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">Analog I/O</h3> |
|
|
<p class="text-gray-400 text-sm">analogRead(), analogWrite(), analogReference()</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-green-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-green-500 to-cyan-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="clock" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">Time Functions</h3> |
|
|
<p class="text-gray-400 text-sm">millis(), micros(), delay(), delayMicroseconds()</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-yellow-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-yellow-500 to-orange-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="terminal" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">Serial Communication</h3> |
|
|
<p class="text-gray-400 text-sm">Serial.begin(), Serial.print(), Serial.read()</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-indigo-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="cpu" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">Advanced I/O</h3> |
|
|
<p class="text-gray-400 text-sm">shiftOut(), pulseIn(), tone(), noTone()</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-pink-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-pink-500 to-orange-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="wifi" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">WiFi & IoT</h3> |
|
|
<p class="text-gray-400 text-sm">WiFi library, ESP8266, ESP32 functions</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-cyan-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-cyan-500 to-teal-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="server" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">I2C & SPI</h3> |
|
|
<p class="text-gray-400 text-sm">Wire library, SPI communication protocols</p> |
|
|
</div> |
|
|
|
|
|
<div class="bg-gray-800/50 backdrop-blur-sm rounded-2xl p-6 border border-white/10 hover:border-red-500/50 transition-all duration-300 cursor-pointer"> |
|
|
<div class="w-12 h-12 bg-gradient-to-r from-red-500 to-pink-600 rounded-xl mb-4 flex items-center justify-center"> |
|
|
<i data-feather="file-text" class="w-6 h-6 text-white"></i> |
|
|
</div> |
|
|
<h3 class="text-xl font-bold mb-2">Libraries</h3> |
|
|
<p class="text-gray-400 text-sm">Built-in and contributed libraries</p> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="mb-16"> |
|
|
<h2 class="text-3xl font-bold mb-8 text-center">Most Popular Functions</h2> |
|
|
<div class="grid gap-6"> |
|
|
|
|
|
<div class="bg-gray-800/30 backdrop-blur-sm rounded-2xl p-8 border border-white/10 hover:border-cyan-500/30 transition-all duration-300"> |
|
|
<div class="flex justify-between items-start mb-4"> |
|
|
<h3 class="text-2xl font-bold text-cyan-400">pinMode()</h3> |
|
|
<span class="px-3 py-1 bg-cyan-500/20 text-cyan-400 rounded-full text-sm">Digital I/O</span> |
|
|
</div> |
|
|
<p class="text-gray-300 mb-6">Configures the specified pin to behave either as an input or an output.</p> |
|
|
|
|
|
<div class="grid md:grid-cols-2 gap-6"> |
|
|
<div> |
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Syntax</h4> |
|
|
<div class="bg-gray-900 rounded-lg p-3 mb-4"> |
|
|
<code class="text-cyan-400">pinMode(pin, mode)</code> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Parameters</h4> |
|
|
<ul class="text-gray-400 space-y-1"> |
|
|
<li><code class="text-cyan-400">pin</code>: the Arduino pin number</li> |
|
|
<li><code class="text-cyan-400">mode</code>: INPUT, OUTPUT, or INPUT_PULLUP</li> |
|
|
</ul> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Example</h4> |
|
|
<div class="bg-gray-900 rounded-lg p-4"> |
|
|
<pre class="text-gray-300 text-sm"><code>void setup() { |
|
|
pinMode(LED_BUILTIN, OUTPUT); // sets the digital pin 13 as output |
|
|
} |
|
|
|
|
|
void loop() { |
|
|
digitalWrite(LED_BUILTIN, HIGH); // turns the LED on |
|
|
delay(1000); // waits for 1 second |
|
|
digitalWrite(LED_BUILTIN, LOW); // turns the LED off |
|
|
delay(1000); // waits for 1 second |
|
|
}</code></pre> |
|
|
</div> |
|
|
|
|
|
<div class="mt-4 flex gap-2"> |
|
|
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-sm transition-colors"> |
|
|
<i data-feather="copy" class="w-4 h-4 inline mr-1"></i> Copy |
|
|
</button> |
|
|
<button class="px-4 py-2 bg-cyan-600 hover:bg-cyan-500 rounded-lg text-sm transition-colors"> |
|
|
<i data-feather="play" class="w-4 h-4 inline mr-1"></i> Try it |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="bg-gray-800/30 backdrop-blur-sm rounded-2xl p-8 border border-white/10 hover:border-purple-500/30 transition-all duration-300"> |
|
|
<div class="flex justify-between items-start mb-4"> |
|
|
<h3 class="text-2xl font-bold text-purple-400">digitalWrite()</h3> |
|
|
<span class="px-3 py-1 bg-purple-500/20 text-purple-400 rounded-full text-sm">Digital I/O</span> |
|
|
</div> |
|
|
<p class="text-gray-300 mb-6">Write a HIGH or LOW value to a digital pin.</p> |
|
|
|
|
|
<div class="grid md:grid-cols-2 gap-6"> |
|
|
<div> |
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Syntax</h4> |
|
|
<div class="bg-gray-900 rounded-lg p-3 mb-4"> |
|
|
<code class="text-purple-400">digitalWrite(pin, value)</code> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Parameters</h4> |
|
|
<ul class="text-gray-400 space-y-1"> |
|
|
<li><code class="text-purple-400">pin</code>: the Arduino pin number</li> |
|
|
<li><code class="text-purple-400">value</code>: HIGH or LOW</li> |
|
|
</ul> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Example</h4> |
|
|
<div class="bg-gray-900 rounded-lg p-4"> |
|
|
<pre class="text-gray-300 text-sm"><code>int ledPin = 13; // LED connected to digital pin 13 |
|
|
|
|
|
void setup() { |
|
|
pinMode(ledPin, OUTPUT); // sets the digital pin as output |
|
|
} |
|
|
|
|
|
void loop() { |
|
|
digitalWrite(ledPin, HIGH); // sets the LED on |
|
|
delay(1000); // waits for a second |
|
|
digitalWrite(ledPin, LOW); // sets the LED off |
|
|
delay(1000); // waits for a second |
|
|
}</code></pre> |
|
|
</div> |
|
|
|
|
|
<div class="mt-4 flex gap-2"> |
|
|
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-sm transition-colors"> |
|
|
<i data-feather="copy" class="w-4 h-4 inline mr-1"></i> Copy |
|
|
</button> |
|
|
<button class="px-4 py-2 bg-purple-600 hover:bg-purple-500 rounded-lg text-sm transition-colors"> |
|
|
<i data-feather="play" class="w-4 h-4 inline mr-1"></i> Try it |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="bg-gray-800/30 backdrop-blur-sm rounded-2xl p-8 border border-white/10 hover:border-green-500/30 transition-all duration-300"> |
|
|
<div class="flex justify-between items-start mb-4"> |
|
|
<h3 class="text-2xl font-bold text-green-400">analogRead()</h3> |
|
|
<span class="px-3 py-1 bg-green-500/20 text-green-400 rounded-full text-sm">Analog I/O</span> |
|
|
</div> |
|
|
<p class="text-gray-300 mb-6">Reads the value from the specified analog pin. Arduino boards contain a multichannel, 10-bit analog to digital converter.</p> |
|
|
|
|
|
<div class="grid md:grid-cols-2 gap-6"> |
|
|
<div> |
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Syntax</h4> |
|
|
<div class="bg-gray-900 rounded-lg p-3 mb-4"> |
|
|
<code class="text-green-400">analogRead(pin)</code> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div> |
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Parameters</h4> |
|
|
<ul class="text-gray-400 space-y-1"> |
|
|
<li><code class="text-green-400">pin</code>: the analog input pin number</li> |
|
|
</ul> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<h4 class="text-lg font-semibold mb-2 text-white">Example</h4> |
|
|
<div class="bg-gray-900 rounded-lg p-4"> |
|
|
<pre class="text-gray-300 text-sm"><code>int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3 |
|
|
// outside leads to ground and +5V |
|
|
int val = 0; // variable to store the value read |
|
|
|
|
|
void setup() { |
|
|
Serial.begin(9600); // setup serial |
|
|
} |
|
|
|
|
|
void loop() { |
|
|
val = analogRead(analogPin); // read the input pin |
|
|
Serial.println(val); // debug value |
|
|
}</code></pre> |
|
|
</div> |
|
|
|
|
|
<div class="mt-4 flex gap-2"> |
|
|
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-sm transition-colors"> |
|
|
<i data-feather="copy" class="w-4 h-4 inline mr-1"></i> Copy |
|
|
</button> |
|
|
<button class="px-4 py-2 bg-green-600 hover:bg-green-500 rounded-lg text-sm transition-colors"> |
|
|
<i data-feather="play" class="w-4 h-4 inline mr-1"></i> Try it |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="text-center"> |
|
|
<a href="/" class="inline-flex items-center gap-2 text-cyan-400 hover:text-cyan-300 transition-colors"> |
|
|
<i data-feather="arrow-left" class="w-5 h-5"></i> |
|
|
Back to Home |
|
|
</a> |
|
|
</div> |
|
|
</div> |
|
|
</section> |
|
|
|
|
|
|
|
|
<doc-footer></doc-footer> |
|
|
|
|
|
<script src="components/navbar.js"></script> |
|
|
<script src="components/footer.js"></script> |
|
|
<script src="script.js"></script> |
|
|
<script>feather.replace();</script> |
|
|
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script> |
|
|
</body> |
|
|
</html> |